HACKER Q&A
📣 bruce343434

Why is the byte order little-endian, but the bit order is big-endian?


For context: on the linux rust support thread there was a discussion about little-endian vs big endian. But nobody seemed to say anything about the bit-order.

https://news.ycombinator.com/item?id=27746851


  👤 zajio1am Accepted Answer ✓
There is no real bit-endianity on the same level as byte-endianity, as there is no real bit-order. You could easily imagine bits to be perpendicular to byte memory cells.

There is one place in computers where there is real bit-order, and that when it is represented on serial lines.


👤 JoeAltmaier
On a computer bus, bits are often transmitted in parallel. So there is no order; they all arrive at the same time. On Ethernet bits are transmitted one at a time, and are 'little-endian'.

👤 kabdib
IBM's 360 series numbers bits from 0 to 31, with bit 0 being most significant.

I know I've seen material where a CPU numbered bits from 1 to 32, with 1 being most significant, but I can't remember the manufacturer.

Let us not forget the PDP-11, whose 32-bit format is both BE (in bytes) and LE (in words).


👤 nemetroid
I think you need to qualify in what sense bits are big endian. ”Bit 0” is reasonably the first one, and that usually refers to the least significant bit.

👤 mytailorisrich
In term of hardware I think this is irrelevant: lines are labelled 0 to n, that's unequivocal.

Now, why is bit 0 the lowest? Well I think this follows naturally from binary representation as a polynomial of powers or two. So bit 0 is 2^0, bit 1 is 2^1, etc. Representation with digits in base 2 also simply follows standard order of numerals: 100 is one hundred, not zero zero one whether in decimal or binary.

The issue of big-endian vs little-endian really arises when you want to represent a word across bytes. Different people made different choices, since they are equally valid.

Now, over a serial line you can also decide to transmit bits one way or the other, and this can indeed go either way depending on the interface, either LSB (least significant bit) first or MSB (most significant bit) first.



👤 ThePadawan
AFAIK big-endian bit order makes the very very very low-level circuits easier.

Want to compare two numbers? You can short-circuit (hah) as soon as the leftmost bit is different.


👤 pansa2
Bit order is little-endian - the lowest-numbered bit is least significant.