Delete an accessor nothing used, stop repeating the guards, cut the comments - #3
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No behaviour change. Removes a bunch of dead code
sh_temp()had no callers so nuking itsh_digital_in/outandsh_set_digital_in/outeach repeated the null check, the range check and the shift. They now sharebit_getandbit_set, and the public functions are one line each.Also slimmed down on comments