Commit 5b1b56d
Tighten upper-bound debug_assert in bitfield_unit accessors
The upper-bound check in get/set/raw_get/raw_set and their const-generic
siblings used floor division: `(bit_offset + bit_width) / 8 <= len`.
The byte-loop touches indices up to
`start_byte + bytes_needed - 1 = ceil((bit_offset + bit_width) / 8) - 1`,
so the correct check is `(bit_offset + bit_width + 7) / 8 <= len`.
Codegen never produces values that would fail the tighter assert, so
this is a hardening of the safety check rather than a runtime fix.
Regenerate the matching expectations.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 0c5b8d3 commit 5b1b56d
43 files changed
Lines changed: 428 additions & 344 deletions
File tree
- bindgen-tests/tests/expectations/tests
- bindgen/codegen
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 10 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments