Endianness

Gulliver's Travels by Jonathan Swift, the novel from which the term was coined

In computing, endianness is the order in which bytes within a word of digital data are transmitted over a data communication medium or addressed (by rising addresses) in computer memory, counting only byte significance compared to earliness. Endianness is primarily expressed as big-endian (BE) or little-endian (LE), terms introduced by Danny Cohen into computer science for data ordering in an Internet Experiment Note published in 1980.[1] The adjective endian has its origin in the writings of 18th century Anglo-Irish writer Jonathan Swift. In the 1726 novel Gulliver's Travels, he portrays the conflict between sects of Lilliputians divided into those breaking the shell of a boiled egg from the big end or from the little end.[2][3] By analogy, a CPU may read a digital word big end first, or little end first.

Computers store information in various-sized groups of binary bits. Each group is assigned a number, called its address, that the computer uses to access that data. On most modern computers, the smallest data group with an address is eight bits long and is called a byte. Larger groups comprise two or more bytes, for example, a 32-bit word contains four bytes. There are two possible ways a computer could number the individual bytes in a larger group, starting at either end. Both types of endianness are in widespread use in digital electronic engineering. The initial choice of endianness of a new design is often arbitrary, but later technology revisions and updates perpetuate the existing endianness to maintain backward compatibility.

A big-endian system stores the most significant byte of a word at the smallest memory address and the least significant byte at the largest. A little-endian system, in contrast, stores the least-significant byte at the smallest address.[4][5][6] Of the two, big-endian is thus closer to the way the digits of numbers are written left-to-right in English, comparing digits to bytes. Bi-endianness is a feature supported by numerous computer architectures that feature switchable endianness in data fetches and stores or for instruction fetches. Other orderings are generically called middle-endian or mixed-endian.[7][8][9][10]

Big-endianness is the dominant ordering in networking protocols, such as in the Internet protocol suite, where it is referred to as network order, transmitting the most significant byte first. Conversely, little-endianness is the dominant ordering for processor architectures (x86, most ARM implementations, base RISC-V implementations) and their associated memory. File formats can use either ordering; some formats use a mixture of both or contain an indicator of which ordering is used throughout the file.[11]

  1. ^ Cohen, Danny (1980-04-01). On Holy Wars and a Plea for Peace. IETF. IEN 137. Also published at Cohen, Danny (October 1981). "On Holy Wars and a Plea for Peace". IEEE Computer. 14 (10): 48–54. doi:10.1109/C-M.1981.220208.
  2. ^ Swift, Jonathan (1726). "A Voyage to Lilliput, Chapter IV". Gulliver's Travels. Archived from the original on 2022-09-20. Retrieved 2022-09-20.
  3. ^ Bryant, Randal E.; David, O'Hallaron (2016), Computer Systems: A Programmer's Perspective (3 ed.), Pearson Education, p. 79, ISBN 978-1-488-67207-1
  4. ^ "Understanding big and little endian byte order". Archived from the original on 2019-05-24. Retrieved 2019-05-20.
  5. ^ "Byte Ordering PPC". Archived from the original on 2019-05-09. Retrieved 2019-05-20.
  6. ^ "Writing endian-independent code in C". Archived from the original on 2019-06-10. Retrieved 2019-05-20.
  7. ^ "Internet Hall of Fame Pioneer". Internet Hall of Fame. The Internet Society. Archived from the original on 2021-07-21. Retrieved 2015-10-07.
  8. ^ Cary, David. "Endian FAQ". Archived from the original on 2017-11-09. Retrieved 2010-10-11.
  9. ^ James, David V. (June 1990). "Multiplexed buses: the endian wars continue". IEEE Micro. 10 (3): 9–21. doi:10.1109/40.56322. ISSN 0272-1732. S2CID 24291134.
  10. ^ Blanc, Bertrand; Maaraoui, Bob (December 2005). "Endianness or Where is Byte 0?" (PDF). Archived (PDF) from the original on 2007-12-03. Retrieved 2008-12-21.
  11. ^ A File Format for the Exchange of Images in the Internet. April 1992. p. 7. doi:10.17487/RFC1314. RFC 1314. Retrieved 2021-08-16.