News for hackers. Stuff that matters.
Re:Ask HN: Why is the byte order little-endian, but the bit ... by zajio1am on Tuesday July 06, 2021 @03:28PM (#27753175)
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.

Re:Ask HN: Why is the byte order little-endian, but the bit ... by runnerup on Tuesday July 06, 2021 @05:52PM (#27754831)
Just adding onto this. Someone else already talked about the hardware level, where the bits for a byte arrive simultaneously over a bus.

Generally this question is asked primarily by software people. It's worth noting that there's no way to access a bit in memory. The "atomic" level in modern computers is the byte. You can read a byte from memory, you can write a byte to memory. You cannot read or write a single bit.

That is to say that it doesn't matter what endian-ness the bit order is. There's no way for the CPU to ever peek inside the RAM to see how the bits are arranged in the byte. The memory could store it in completely random order, with each block of memory shuffling the bits differently from every other block -- as long as it send the data to the CPU in the expected fashion.

Re:Ask HN: Why is the byte order little-endian, but the bit ... by zeroimpl on Tuesday July 06, 2021 @11:58PM (#27757193)
I wonder if this misconception has more to do with the fact that programming languages define left/right bitshift operators and since left shift means making a number bigger, that implies the most significant bits are on the left (eg first in a LTR language).
Re:Ask HN: Why is the byte order little-endian, but the bit ... by ampdepolymerase on Wednesday July 07, 2021 @10:19AM (#27761414)
And also floating point specifications.
Re:Ask HN: Why is the byte order little-endian, but the bit ... by colanderman on Tuesday July 06, 2021 @03:39PM (#27753281)
If anything, bit order on most CPUs can be considered "little endian", because that's how CPU documentation numbers the bits (0, the first, being the lowest order). Not to mention bit-field insert/extract opcodes, like BEXTR on x86 [1] or UBFX on ARM [2].

As another commenter points out, IBM is one of the few to reverse this and number bits in a big-endian order on their big-endian processors, with 0 being the most significant.

[1] https://www.felixcloutier.com/x86/bextr

[2] https://www.keil.com/support/man/docs/armasm/armasm_dom13612...

Re:Ask HN: Why is the byte order little-endian, but the bit ... by Gibbon1 on Wednesday July 07, 2021 @04:50PM (#27765596)
A long time ago TI's bit order was reversed from everyone elses. I remember because I wired one of their chips the way you would expect and didn't work right.

My opinion big endian should be intentionally unsupported.

Re:Ask HN: Why is the byte order little-endian, but the bit ... by sigjuice on Thursday July 08, 2021 @03:18PM (#27776522)
There are other possibilities for numbering bits. I have seen PowerPC documentation where 32-bit registers have bits numbered from 32 to 63, with 32 being the most significant.
Re:Ask HN: Why is the byte order little-endian, but the bit ... by SquibblesRedux on Wednesday July 07, 2021 @04:37PM (#27765496)
Bytes, words, etc. can also be stored and manipulated in the CPU, in which case 2-complement, rotates, shifts, etc. do have a directionality about them.

Certain bit-sliced microcode architectures can also impose a certain directionality for the bits.

Finally, serial communications and storage impose directionality upon the bit stream. (Anyone remember writing to magnetic tape?)

Re:Ask HN: Why is the byte order little-endian, but the bit ... by glandium on Tuesday July 06, 2021 @09:35PM (#27756402)
There is a sort of bit-endianity when you look at hex dumps of data, where you'd see something like "34 12" that represents the 16-bit value 0x1234 if the data was little endian.