4 ms·
It's just the convention we've adopted for bit positioning. To the programmer, it doesn't matter since you never actually see sub-byte data, so we just conventi
by kstenerud 5y ago
It's just the convention we've adopted for bit positioning. To the programmer, it doesn't matter since you never actually see sub-byte data, so we just conventionally use the same meaning of shift "left" and shift "right" opcodes regardless of byte-endianness or how the CPU itself arranges the bits.
So if we had followed the original Indian endianness, then a shift "left" would divide by 2 and a shift "right" would multiply by 2. All of our troubles stem from not swapping the digits around when we adopted the Indian/Arabic number system in the 10th century - we had to keep up the convention at first because it was compatible, and later because it's "natural".