Skip to content

Commit 496817f

Browse files
Jeremy Fitzhardingeemilio
authored andcommitted
Optimize BitfieldUnit get/set with byte-wise operations
Replace bit-at-a-time loops in get(), set(), raw_get(), and raw_set() with byte-wise shift/mask operations. This significantly improves performance for multi-bit field access. The new implementation reads/writes bytes in chunks and uses shifts and masks to extract/insert values, rather than iterating over each bit individually. For big-endian targets, the algorithm reverses bits within bytes and the final value to maintain the same semantics as the original implementation.
1 parent 7c38446 commit 496817f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+4489
-1431
lines changed

bindgen-tests/tests/expectations/tests/bitfield-32bit-overflow.rs

Lines changed: 106 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/bitfield-large.rs

Lines changed: 106 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)