
Joel wrote:
Bit ordering is completely arbitrary. If the constructor for reference in dynamic_bitset.hpp is changed from:
// the one and only non-copy ctor reference(block_type & b, block_type pos) :m_block(b), m_mask( (assert(pos < bits_per_block), block_type(1) << pos ) ) { }
to:
// the one and only non-copy ctor reference(block_type & b, block_type pos) :m_block(b), m_mask( (assert(pos < bits_per_block), ((block_type(1) << (bits_per_block-1)) >> pos )) ) { }
and the ordering would be reversed. Now on little-endian machines, the ordering nicely goes always left-to-right.
If you're thinking about individual bits being "next to" bits in other bytes, and bits or bytes being "left" or "right" of each other, your mental model of endianness is over-complicated. Because bits are not individually addressable, the only thing that matters is the order of bytes (which are addressable) within words. Ordering of bits only matters when someone draws a picture of something like a peripheral register. Regards, Phil.