Learn something new every day
More Info... by email
Endianness is the function of a system that details integer representation. It orders the way the numbers appear. Much like a spoken language, integers as part of codes must be translated onto paper. While some cultures read right to left and some read left to right, numbers in codes can also be arranged either from right to left or left to right.
A system’s memory contains bytes, and each location in the system stores one element of the memory. These elements are usually bytes, although some systems store bits. One word or integer translates to 32 bits, or four bytes. Since each memory address can only store one byte, not four, the integer must split into individual bytes, which each use two digits to represent that byte’s value.
The term endianness comes from the book Gulliver’s Travels by Jonathan Swift, where he satirically describes the differences between the way people eat boiled eggs—either from the big end or the little end. Hence, endianness comes in two varieties: big endian and little endian. A big endian arrangement takes an integer consisting of multiple bytes and places the most significant of these bytes on the left. The most significant byte is stored in the smallest address. This type of byte ordering is easy to comprehend by those who speak languages such as English, where text is read from left to right.
A little endian arrangement is one in which the most important byte in a multibyte integer will be on the right. Here, the least significant byte is stored in the smallest address. This makes for a right to left reading, like the Hebrew and Arabic languages. To keep byte ordering straight, remember that when the least significant byte (LSB) is stored first, it’s called little endian. When the most significant byte (MSB) is stored first, it’s called big endian.
All systems are either big or little endian, and some have a register bit, which allows the user to choose the preferred endianness. When storing integers in a system file, the file might be sent to a machine that uses the other type of endianness. The numbers would be backward, and the message would not make any sense. Typically, when it is uncertain which endianness to use, something called network byte order comes into play. With this, integers are sent in groups of four bytes of either big or little endianness, picked at random, and the machine that receives the integers can reverse the bytes if the endiannesses do not match.
Endianness is only used when breaking something of large value, such as a word, into smaller parts. An order in which to store these parts in the system memory is then formed. It is not used when storing a value into a register that can hold all of it. In this case, all bits, right and left, are equally important.
One of our editors will review your suggestion and make changes if warranted. Note that depending on the number of suggestions we receive, this can take anywhere from a few hours to a few days. Thank you for helping to improve wiseGEEK!