I do read hex dumps & disassemblies, and there LE is a huge pain in the backend. Everything is in reverse. Why would a sane programmer voluntarily use LE?
God Save the Network Byte Order!
I do read hex dumps & disassemblies, and there LE is a huge pain in the backend. Everything is in reverse. Why would a sane programmer voluntarily use LE?
God Save the Network Byte Order!
So little-endian is (slightly) more convenient for machines and big-endian is (slightly) more convenient to humans reading memory dumps.
The unfortunate thing is that "network byte order" is big-endian so it's still the traditional endianness to use for wire protocols or on-disk formats. In my own designs I've switched to specifying fixed-width integers as little-endian which makes more sense for 99.9% of computers today.
Contrast with a big-endian representation, where the byte at offset x would have weight 256^(length - 1 - x).
Also, on a 64-bit big-endian architecture, you don't need specialized string comparison instructions to get efficient string comparisons. The code is only slightly more complicated on BE architectures that only support aligned 64-bit loads.
This is literally the opposite of how most programmers in the world write numbers naturally.
See "1234". The digit at offset x from the right has weight 10^x. That corresponds to big-endian.
Considering that the only important difference between little and big endian is when people have to read or write it by hand, we should probably model it after common human representation...
Think about the irony :)
Beyond that, it's called after two stupid factions in Gulliver's Travels for a reason...
I've become fond of thinking about little-endian becoming known as a universal "CPU byte order", to complement "network byte order". Each order makes the most sense for its domain.
Actually LE is the natural order and the question is why anybody sane would prefer BE. The reason you think otherwise is because you view hexdumps the wrong way.
A hexdump shows hexadecimal bytes. Isolate one byte and number the bits -- 76543210, right to left. Number the nibbles -- 10, right to left. Now number the bytes -- 0123..., left to right?
Display your hexdumps with addresses increasing right to left and LE makes perfect sense. This is how numbers are written, so the convention should be followed when displaying numbers.
For showing strings it's better to use left to right, as that's the convention for text.
When Motorola 68000 was out, it was doing 32bits linear addressing.
The mov operation would load directly from the memory by using a direct addressing.
Wiring 32 wires is expensive.
Wiring 2 overlaping address bus of 16 bits partially ovelapping was less. Intel CPU ASM works big endian because we all prefer to write AND 0xFF, DSI to get the 8 lower bit of a number.
The first register would hit segment, and the second the offset.
Hence you would first need to load the page (that would wire the multiplexing) to get the offset in the page/segment.
The addressing bus would be accessed with a stack. So first you push the lower 16 bits, and then the highest 16 bits. Which would revert since its a FIFO in first loading the segment address, then the offset address. The cost of this "savings" in terms of CPU cycle was marginal while the gain in money was tremenduous.