Bit Order Led to a Civil War
Big-Endians and Little-Endians
The following is an summary of an event in Gulliver's Travels, written by Johnathan Swift, published in 1726:
In Lilliput, Gulliver discovers that there's a bitter factional dispute raging between those who break open their eggs at the little end (Little-Endians) and those who choose the big end (Big-Endians). It's a silly, pointless dispute, but it's just the kind of satire you'd expect to happen in Swift's allegorical story.
The Little-Endians and Big-Endians are unable to get along because years ago, after an emperor's son was injured trying to break his egg on the smaller end (the traditional way of egg breaking), he decreed that no one may break an egg by using the smaller end. This caused a great uproar among many of the Lilliputians and led to six rebellions and thousands of deaths. Eventually the Big-Endians were exiled and went to Blefuscu, where they gained favor and convinced the government to go to war against Lilliput.
When the Lilliputians and Blefuscudians went to war, Gulliver was on the side of the Lilliputians. By dragging the entire Blefuscudian fleet of ships to the shore of Lilliput, where "The Emperor and his whole Court stood on the Shore expecting the Issue of the great Adventure." When Gulliver arrives, he cries out, "Long live the most puissant Emperor of Lilliput!" The emperor gives Gulliver the land's highest honor.
Endianness - The Real-Life Debate
Big-endian and little-endian are terms that describe the order in which a sequence of bytes are stored in computer memory. Big-endian is the term used when the "big end" (MSB - Most Significant Byte) in the sequence is stored first. Little-endian is the term used when the "little end" (LSB - Least Significant Byte) is stored first.
For example, if an integer is stored as 4 bytes, then a variable 'x' with a hex value '0x01234567' will be stored as following:
Source:
geeksforgeeks.org
Which team are you on?
The follow examples are based on the current architecture:
- Big-Endians: Motorola Microprocessors, IBM/370 mainframes, OpenRISC-based computers, IBM z/Architecture, Freescale Coldfire, and Atmel AVR32.
- Little-Endians: Intel-based processors, AMD64 / x86-64 processors, Nios II, Andes Technology NDS32, Qualcomm Hexagon, and RISC-V.
- There are also Bi-Endian processors such as the current ARM architecture. These can run in both Little & Big Endian modes.
Which 'endian' is better?
Just like in the Gulliver's Travels example, they each have minute differences, but overall there isn't a 'better' method. In the debate for a universal standard, here are a couple of the arguments being made:
- "Little-Endian" is better because as you increase a numeric value, you may need to add digits to the left (ie. 10 vs. 5510). If you did this on a Big-Endian machine, you would have to move everything to the right which would be more complex and take longer to perform.
- "Big-Endian" is better because the numbers are stored in the order in which they are printed out, so binary to decimal routines are particularly efficient. Also, it is easier to determine if the number is positive or negative (by looking at the byte in offset 0).
The Divided Future
Since large-scale manufacturers have been using opposite 'endianness' for quite some time now, it is unlikely there will be a consensus for a universal standard. Luckily, most of the issues that arise from this problem are fixed by converters though. File formats generally have a standard of how they are saved, but sometimes there is trouble when dealing with programs and protocols that go beyond a single PC.
Is there going to be a civil war based upon little vs. big-endian like in the story Gulliver's Travels? Most likely the answer is 'no', but we expect the debate to continue unless there can be an established standard for future processors.