Skip to content

Delete an accessor nothing used, stop repeating the guards, cut the comments - #3

Merged
taciturnaxolotl merged 1 commit into
mainfrom
refactor/trim-the-api
Sep 26, 2026
Merged

taciturnaxolotl merged 1 commit into
mainfrom
refactor/trim-the-api

Conversation

@taciturnaxolotl

@taciturnaxolotl taciturnaxolotl commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

No behaviour change. Removes a bunch of dead code

sh_temp() had no callers so nuking it

sh_digital_in/out and sh_set_digital_in/out each repeated the null check, the range check and the shift. They now share bit_get and bit_set, and the public functions are one line each.

Also slimmed down on comments

sh_temp() had no callers outside the tests written to exercise it, and the
bench tool in this very repo reached past it to read packet->temps directly.
An accessor its own author bypasses is not pulling its weight. Every real call
site indexes with a compile-time constant, where the bound is already known.

sh_analog() stays, for the one reason that distinguishes them: CarDisplay
passes an index that comes from runtime channel configuration, so the check
there is load-bearing.

The four digital accessors repeated the same null guard, range guard and shift
four times. They now share bit_get and bit_set, so there is one copy of the
logic and the guards cannot drift apart. That matters for the mutation job:
deleting one range check should not leave three others to pass the tests.

Also cut the comments back. Several blocks ran past twenty and one past thirty
lines, narrating debugging sessions and repeating what the commit messages and
PR descriptions already say. Reference material stays: the frame diagram, the
field tables, the return-value tables. The editorialising is gone.

No behaviour change. All 1378 checks pass, all nine mutations are still caught,
and the mutation targeting the digital bounds check now hits both shared
helpers instead of one of four copies.
@taciturnaxolotl
taciturnaxolotl merged commit 793899a into main Sep 26, 2026
10 checks passed
@taciturnaxolotl
taciturnaxolotl deleted the refactor/trim-the-api branch September 26, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant