What is Endianness¶
Endianness 1, at least as far as computing is concerned, is the ordering of bytes within a binary representation of data. The most common representations of endianness are Big-Endian and Little-Endian. There exist other forms, such as Middle-Endian, but those are beyond the scope of this document.
Etymology¶
The Computer Science terms Big-Endian and Little-Endian were introduced by Danny Cohen 2 in 1980. The key term endian has its roots in the novel Gulliver’s Travels 3 by Jonathan Swift 4 where within a war occurs between two factions who are fighting over which end of a boiled egg should be opened for eating. The big end or the little end. Unsurprisingly, the same said book was the inspiration for the naming of the Gulliver library.
Big-Endian¶
Big-Endian, often referred to as Network Byte Order, ordering is left-to-right. Given the representation of an unsigned number in bytes the further to the left that a byte exists the more significant it is.
For example, the decimal value of the unsigned integer \(8675309_{10}\) may be represented as \(0x845FED_{16}\) in hexadecimal. This hexadecimal value is composed of the three bytes \(0x84_{16}\), \(0x5F_{16}\), and \(0xED_{16}\). As such the value \(8675309_{10}\) may be represented in Big-Endian as a byte stream of \([0x5C_{16}, 0x7B_{16}, 0x2A_{16}]\).
Big-Endian integer representation likely comes as second nature to developers familiar with right-to-left Arabic numerals 5 representation.
Little-Endian¶
Little-Endian ordering is right-to-left. Given the representation of an unsigned number in bytes the further to the right a byte exists the more significant it is.
For example, the decimal value of the unsigned integer \(8675309_{10}\) may be represented as \(0x845FED_{16}\) in hexadecimal. This hexadecimal value is composed of the three bytes \(0x84_{16}\), \(0x5F_{16}\), and \(0xED_{16}\). But because little-endian byte order is left to right \(8675309_{10}\) may be represented in Little-Endian as a byte stream of \([0xED_{16}, 0x5F_{16}, 0x84_{16}]\).
To developers most affiliated with right-to-left natural languages Little-Endian may seem backwards.
Footnotes
- 1
Wikipedia contributors. (2019, October 10). Endianness. In Wikipedia, The Free Encyclopedia. Retrieved 18:31, October 13, 2019, from https://en.wikipedia.org/w/index.php?title=Endianness&oldid=920566520.
- 2
Cohen, Danny the computer scientist that termed the phrase “endian” referring to byte order.
- 3
Gulliver’s Travels a book.
- 4
Swift, Jonathan, author of Gulliver’s Travels.
- 5
Arabic numerals are the typical digital number format used in the English language.