3 ms·
There are two main applications where I find little endian is more logical: big integer implementations, and bit stream encoding. With big integers, the logic
by atq2119 7y ago
There are two main applications where I find little endian is more logical: big integer implementations, and bit stream encoding.
With big integers, the logic is simple: if you use little endian, you can operate on the same memory representation of the bigints quite easily with machine integers of different sizes.
A similar phenomenon happens with bit encoding. Let's say you want to encode a sequence of 25-bit integers tightly packed in memory. How do you do that? With little endian, you get a somewhat more natural representation especially for seeking into the bitstream (especially for architectures that allow unaligned memory accesses).
- BeeOnRope 7y ago> With big integers, the logic is simple: if you use little endian, you can operate on the same memory representation of the bigints quite easily with machine integers of different sizes. That's true with big endian too, but you just have to store your integers in the opposite way as you would on little endian: with the MSB at the lowest address (which of course is the same as the distinction between little and big endian in the first place). Basically the bigint layout has to be compatible with the the endianess. I don't know what bignum implementations do in practice on big endian systems though.