Big-endian and little-endian formats

Jyothi
Mar 28, 2024

--

There are two types of endianness in computing: big endian and little endian. Endianness refers to how processors store or interpret multi-byte integers. A processor either stores the most significant byte (MSB) at the lower address or the least significant byte (LSB) at the lower address.

In big-endian systems, the most significant byte starts at the lower address, while in little-endian systems, the least significant byte starts at the lower address. For instance, ARM and x86 processors support little-endianness, whereas NXP PowerPC processors support big-endianness.

Let’s consider a 16-bit integer 0x1234.

In a big-endian system, it is stored in memory as:

In a little-endian system, it is stored in memory as:

Here’s a C code snippet to determine if the system is little-endian or big-endian:

--

--