3 ms·
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 mem
by zajio1am 5y ago
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.
- colanderman 5y agoIf 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 https://www.felixcloutier.com/x86/bextr [2] https://www.keil.com/support/man/docs/armasm/armasm_dom1361289914598.htm https://www.keil.com/support/man/docs/armasm/armasm_dom13612...
- Gibbon1 5y agoA 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.
- sigjuice 5y agoThere 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.
- runnerup 5y agoJust 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.
- zeroimpl 5y agoI 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).
- ampdepolymerase 5y agoAnd also floating point specifications.
- bronzeage 5y agoC has bitfields. These bitfields correspond to a specific bit order. I think in normal x86 it's little bit endianity - the first bit in a bitfield is the least significant. It's not specified in the C spec, but I've seen code depending on it nonetheless.
- glandium 5y agoThere 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.
- SquibblesRedux 5y agoBytes, 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?)