Endianness

From CPUDev Wiki
Jump to: navigation, search

Endianness determines the order of bytes of multibyte values in main memory.

Little Endian

This is nowadays the most common endianness for ISAs. It means the least significant byte is stored first and the most significant byte is stored last. For example the 32-bit value 0xCAFEF00D would be stored as 0x0D | 0xF0 | 0xFE | 0xCA. This might seem illogical, unless you consider a variable can be used as 8-bit, 16-bit, 32-bit or 64-bit without changing it's base address.

Big Endian

This is also called the "network byte order". It means the most significant byte is stored first and the least significant byte is stored last. For example the 32-bit value 0xCAFEF00D would be stored as 0xCA | 0xFE | 0xF0 | 0x0D. This has the advantage of being more human readable in a hex dump, since it resembles the left-to-right order of digits.