Endianness of a processor

If you are installing an Endian-specific software on your computer you need to know Endianness of your processor.Also if you are/want to become a software engineer or Computer hardware engineer you must know about Endianess..!!

Now we will see what are it’s importance, merits and demerits of this feature of a processor.

Precisely describing “Endianness is the format to how multi-byte data is stored in computer memory. It describes the location of the most significant byte (MSB) and least significant byte (LSB) of an address in memory”

NOTE1: Endianness is dictated by the CPU architecture implementation of the system. The operating system does not dictate the endian model implemented, but rather the endian model of the CPU architecture dictates how the operating system is implemented.

NOTE2:  Endian order means that any time a computer accesses a stream (a network tap, a local file, or an audio, video or multimedia stream), the computer has to know how the file is constructed. For example: if you write out a graphics file (such as a .BMP file, which is Little-Endian format) on a Big-Endian machine, you must first reverse the byte order of each integer you write or another “standard” program will not be able to read the file.

Endianness describes how multi-byte data is represented by a computer system and is dictated by the CPU architecture of the system. Unfortunately not all computer systems are designed with the same Endian- architecture. The difference in Endian-architecture is an issue when software or data is shared between computer systems. An analysis of the computer system and its interfaces will determine the requirements of the Endian implementation of the software. Software is sometimes designed with one specific Endian-architecture in mind, limiting the portability of the code to other processor architectures. This type of implementation is considered to be Endian-specific. However, Endian-neutral software can be developed, allowing the code to be ported easily between processors of different Endian-architectures, and without rewriting any code. Endian-neutral software is developed by identifying system memory and external data interfaces, and using Endian-neutral coding practices to implement the interfaces.Platform migration requires consideration of the Endian-architecture of the current and target platforms, as well as the Endian-architecture of the code.

To show two reparesentation formats:

Consider  0x12345678 (32-bit hexadecimal 12345678) will be stored in the order as below.

TAble1: Storage format of two Endians

Endianess Byte 00 Byte 01 Byte 02 Byte 03
Big-Endian 12(MSB) 34 56 78(LSB)
Little-Endian 78(LSB) 56 34 12(MSB)

So, big-Endian stores the MSB at the lowest memory address. Little-Endian stores the LSB at the lowest memory address. The lowest memory address of multi-byte data is considered the starting address of the data.

Merits of Endian-architecture:

In “Little-Endian” form, assembly language instructions for picking up a 1, 2, 4, or longer byte number proceed in exactly the same way for all formats: first pick up the lowest order byte at offset 0. Also, because of the 1:1 relationship between address offset and byte number (offset 0 is byte 0), multiple precision math routines are correspondingly easy to write.

In “Big-Endian” form, by having the high-order byte come first, you can always test whether the number is positive or negative by looking at the byte at offset zero. You don’t have to know how long the number is, nor do you have to skip over any bytes to find the byte containing the sign information. The numbers are also stored in the order in which they are printed out, so binary to decimal routines are particularly efficient. Most embedded communication processors and custom solutions associated with the data plane are Big-Endian (i.e. PowerPC, SPARC, etc.). Because of this, legacy code on these processors is often written specifically for
network byte order (Big-Endian).


There are two main areas where Endianness must be considered in any system. One area pertains to code portability. The
second area pertains to sharing data between platforms.
Code Portability:
It is not uncommon for software to be designed and implemented for the Endian-architecture of a specific
processor platform, without allowing for ease of portability to other platforms.
Endian-neutral code provides flexibility for software implementations to be compiled for and operate seamlessly
on processors of different Endian-architectures.
Shared Data:
Computer systems are made up of multiple components, including computers, interfaces, data storage and
shared memory. Any time file data or memory is shared between computers, there is a potential for an Endian-
architecture conflict. Data can be stored in ways that are not tied to endian-architecture and also in ways that
define the Endianness of the data.

List of several popular computer systems and their Endian-architectures. Note that some CPUs can be either big or little endian (Bi-Endian) by setting a processor register to the desired endian-architecture.

Table2. Computer system Endianness

Platform Endian-Architecture
ARM* Bi-Endian
DEC Alpha* Little-Endian
HP PA-RISC 8000* Bi-Endian
IBM PowerPC Bi-Endian
intel 80×86 Little-Endian
Intel IXP network processors Bi-Endian
Intel Itanium Processor family Bi-Endian
Java Virtual machine* Big-Endian
MIPS* Bi-Endian
Motorola 68k Big-Endian
Sun SPARC* Big-Endian

Abbreviations & Descriptions used:
ARM – Advanced RISC Machines Ltd.
CPU -Central Processing Unit
DEC – Digital Equipment Corporation
IA  – Intel Architecture
I/O  – Input / Output
IBM – International Business Machines Corporation
LSB – Least Significant Byte
MSB – Most Significant Byte
MIPS – MIPS Technologies, Inc.
RISC – Reduced Instruction Set Computer

Hope you enjoyed reading and information is useful.:)

Next we will see how to check Endianness of your system by executing a simple C program.



You can also download the document here