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

--- Comment #6 from [email protected] ---
(In reply to Iain Buclaw from comment #5)
> (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".

This depends on the interpretation of "BigEndian". I interpret it as byte
endianness, where BigEndian means: each byte is little endian (`value & 0x1`
giving the value of the LSB) and bytes are packed big endian (`array[0]` giving
the most significant byte). Like wikipedia's interpretation:
https://en.wikipedia.org/wiki/Endianness#Overview

I agree that clarification in the bitfields documentation is needed on the
matter.

--

Reply via email to