5 ms·
In an ideal world which endian format would one go for?
by mrlonglong 5y ago
In an ideal world which endian format would one go for?
- tempodox 5y agoI for one would go for big-endian, simply because reading memory dumps and byte blocks in assembly or elsewhere works without mental byte-swapping arithmetics for multi-byte entities. Just out of curiosity, I would be interested in learning why so many CPUs today are little-endian. Is it because it is cheaper / more efficient for processor implementations or is it because “the others do it, so we do it the same way”?
- bombcar 5y agohttps://stackoverflow.com/questions/5185551/why-is-x86-little-endian https://stackoverflow.com/questions/5185551/why-is-x86-littl... It simplifies certain instructions internally. Practically everything is little endian because x86 won. > And if you think about a serial machine, you have to process all the addresses and data one-bit at a time, and the rational way to do that is: low-bit to high-bit because that’s the way that carry would propagate. So it means that [in] the jump instruction itself, the way the 14-bit address would be put in a serial machine is bit-backwards, as you look at it, because that’s the way you’d want to process it. Well, we were gonna built a byte-parallel machine, not bit-serial and our compromise (in the spirit of the customer and just for him), we put the bytes in backwards. We put the low- byte [first] and then the high-byte. This has since been dubbed “Little Endian” format and it’s sort of contrary to what you’d think would be natural. Well, we did it for Datapoint. As you’ll see, they never did use the [8008] chip and so it was in some sense “a mistake”, but that [Little Endian format] has lived on to the 8080 and 8086 and [is] one of the marks of this family.
- mrlonglong 5y agoAnd does middle endian even exist?
- FabHK 5y agoUS date format: 12/31/2021
- bombcar 5y agoI suspect it does somewhere as a system that had words as the main addressable memory but also allowed byte addressing could have little endian double words but big endian ordering inside the words (as bytes).
- tempodox 5y agoNot currently AFAIK, but apparently the PDP-11 had a middle-endian arch. See other comments in this thread.
- anticristi 5y agoMy brain is trained to read little-endian in memory dumps. It's no different than the German "fünf-und-zwanzig" (five and twenty). :))
- bitwize 5y agoLittle endian. There is no extant big-endian CPU that matters.
- mrlonglong 5y agoI did say in an ideal world.
- bitwize 5y agoHint: The reason why it's called "endianness" comes from the novel Gulliver's Travels, in which the neighboring nations of Lilliput and Blefuscu went to bitter, bloody war over which end to break your eggs from: the big end or the little end. The warring factions were also known as Big-Endians and Little-Endians, and each thought themselves superior to the dirty heathens on the other side. If one side were objectively correct, if there were an inherent advantage to breaking your egg from one side or the other, would there be a war at all?
- dragonwriter 5y ago> if there were an inherent advantage to breaking your egg from one side or the other, would there be a war at all? Fascism vs. not-fascism, Stalinist Communism vs. Western Capitalism, Islamism vs. liberal democracy... I’m not sure “the existence of war around a divide in ideas proves that neither sides ideas are correct” is a particularly comfortable maxim to consider the ramifications of.
- bitwize 5y agoTwo similar societies warring over a trivial idea probably means neither is right. Swift's Big Endians and Little Endians are a satire of the Catholic-Anglican schism in England.
- dragonwriter 5y ago> Two similar societies warring over a trivial idea probably means neither is right. Well, sure, that it’s a trivial idea pretty much inherently means either that neither is right or (and this is very much not an exclusive or) being right doesn’t matter. The problem with real cases is that people inside the conflict don’t believe the idea is trivial (conversely, to people outside rhe conflict—or caught in the middle—even the conflicts we think of as about foundational ideas seem like trivial or irrelevant differences.)
- enqk 5y agohttps://fgiesen.wordpress.com/2014/10/25/little-endian-vs-big-endian/ https://fgiesen.wordpress.com/2014/10/25/little-endian-vs-bi...
- marcosdumay 5y agoWhy would one choose the memory representation of the number based on the advantages of the internal ALU wiring? Of all those reasons, the only one I can make sense of is the "I can’t transparently widen fields after the fact!", and that one is way too niche to explain anything.
- enqk 5y agoI don’t understand? Why not make the memory representation sympathetic with the operations you’re going to do on it? It’s the raison d’être of computers to compute and to do it fast. Another example: memory representation of pixels in GPUs which are swizzled to make computations efficient
- marcosdumay 5y ago> I don’t understand? Why not make the memory representation sympathetic with the operations you’re going to do on it? There's no reason to, as there's no reason not to. It's basically irrelevant. If carrier passing is so important, why can't you just mirror your transistors and operate on the same wires, but on the opposite order? Well, you can, and it's trivial. (And, by the way, carrier passing isn't important. High performances ALU pass carrier only though blocks, that can appear anywhere. And the wiring of those isn't even planar, so how you arrange them isn't a showstopper.)