Debian Codegraph @

debian/rust-vendor/bitvec/doc/order/LocalBits.md

raw
1 # C-Compatible Bit Ordering
2
3 This type alias attempts to match the bitfield ordering used by GCC on your
4 target. The C standard permits ordering of single-bit bitfields in a structure
5 to be implementation-defined, and GCC has been observed to use Lsb0-ordering on
6 little-endian processors and Msb0-ordering on big-endian processors.
7
8 This has two important caveats:
9
10 - ordering of bits in an element is **completely** independent of the ordering
11 of constituent bytes in memory. These have nothing to do with each other in
12 any way. See [the user guide][0] for more information on memory
13 representation.
14 - GCC wide bitfields on big-endian targets behave as `<T, Lsb0>` bit-slices
15 using the `_be` variants of `BitField` accessors. They do not match `Msb0`
16 bit-wise ordering.
17
18 This type is provided solely as a convenience for narrow use cases that *may*
19 match GCC’s `std::bitset<N>`. It makes no guarantee about what C compilers for
20 your target actually do, and you will need to do your own investigation if you
21 are exchanging a single buffer across FFI in this manner.
22
23 [0]: https://bitvecto-rs.github.io/bitvec/memory-representation