Endianness
≈ 5 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
In computing, endianness is the order in which bytes within a word data type are transmitted over a data communication medium or addressed in computer memory, counting only byte significance. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). Computers store information in various-sized groups of binary bits. Each group is assigned a number, called its , 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 .
Larger groups comprise two or more bytes; for example, a often contains 32 bits or 64 bits. There are two principal ways a computer could number the individual bytes in a larger group, starting at either end. 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.
Impact
Of the two, big-endian is thus closer to the way the digits of numbers are written left-to-right in English, with the most significant digit first, comparing digits to bytes and assuming addresses increase from left to right. Both types of endianness are in widespread use in digital electronic engineering.…
Evidence and sources
In computing, endianness is the order in which bytes within a word data type are transmitted over a data communication medium or addressed in computer memory, counting only byte significance. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). Computers store information in various-sized groups of binary bits. Each group is assigned a number, called its , 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 .
Larger groups comprise two or more bytes; for example, a often contains 32 bits or 64 bits. There are two principal ways a computer could number the individual bytes in a larger group, starting at either end. 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.
How it works
Of the two, big-endian is thus closer to the way the digits of numbers are written left-to-right in English, with the most significant digit first, comparing digits to bytes and assuming addresses increase from left to right. 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.
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. 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 or . is the original source of the terms and . Author Jonathan Swift is pictured on the frontispiece of this 1726 edition.
On most systems, the address of a multi-byte value is the address of its first byte (the byte with the lowest address); little-endian systems of that type have the property that, for sufficiently low data values, the same value can be read from memory at different lengths without using different addresses (even when alignment restrictions are imposed).
For example, a 32-bit memory location with content can be read at the same address as either 8-bit (value = 4A), 16-bit (004A), 24-bit (00004A), or 32-bit (0000004A), all of which retain the same numeric value. Although this little-endian property is rarely used directly by high-level programmers, it is occasionally employed by code optimizers as well as by assembly language programmers. While not allowed by C++, such type punning code is allowed as "implementation-defined" by the C11 standard and commonly used in code interacting with hardware.
Text derived from https://en.wikipedia.org/w/index.php?oldid=1374946322 under CC BY-SA 4.0; modifications have been made.