https://issues.dlang.org/show_bug.cgi?id=23573

--- Comment #5 from Iain Buclaw <[email protected]> ---
(In reply to Iain Buclaw from comment #4)
> It is not obvious to the observer that the mixin will generate code to match
> the layout for both big and little endian (depending on which is in effect).
Or more specifically - it's not obvious in the documentation that BigEndian
targets actually layout all fields in reverse.

https://dlang.org/library/std/bitmanip/bitfields.html

"""
The bits are filled in the order given by the parameters, starting with the
lowest significant bit.
"""

Strictly, both parts of this sentence contradict each other.  Because the
lowest significant bit on BigEndian is the "reverse order given".

"""
Create a bitfield pack of eight bits, which fit in one ubyte. The bitfields are
allocated starting from the least significant bit, i.e. x occupies the two
least significant bits of the bitfields storage.
"""

This should be clarified that `x` occupies the two least significant bits on
LittleEndian only.

--

Reply via email to