Debian Codegraph @

debian/rust-vendor/bitvec/doc/field/BitField_Msb0.md

raw
1 # `Msb0` Bit-Field Behavior
2
3 `BitField` has no requirements about the in-memory representation or layout of
4 stored integers within a bit-slice, only that round-tripping an integer through
5 a store and a load of the same element suffix on the same bit-slice is
6 idempotent (with respect to sign truncation).
7
8 `Msb0` provides a contiguous translation from bit-index to real memory: for any
9 given bit index `n` and its position `P(n)`, `P(n + 1)` is `P(n) - 1`. This
10 allows it to provide batched behavior: since the section of contiguous indices
11 used within an element translates to a section of contiguous bits in real
12 memory, the transaction is always a single shift-mask operation.
13
14 Each implemented method contains documentation and examples showing exactly how
15 the abstract integer space is mapped to real memory.
16
17 ## Notes
18
19 In particular, note that while `Msb0` indexes bits from the most significant
20 down to the least, and integers index from the least up to the most, this
21 **does not** reörder any bits of the integer value! This ordering only finds a
22 region in real memory; it does *not* affect the partial-integer contents stored
23 in that region.