The choice between Both is crucial when data is transferred between systems with different byte orderings. Network protocols and file formats often specify the byte order to ensure compatibility between systems. Many modern architectures, especially those based on x86 and x86-64, use Little-Endian by default.
“Little Endian and Big Endian” are two different ways of storing multi-byte data types like integers, floating-point numbers, etc., in computer memory.
The architecture of the processor determines the choice between these two types. Little type is commonly used in x86 and x86-64 architectures, while Big type may be used in some older architectures and network protocols. The endianness of a system can affect data interchange between systems with different endianness.
Little and big are two ways of storing multibyte data types ( int, float, etc).
To illustrate this, let’s consider a 4-byte integer 0x12345678:
Big Type
In this type of system, the lowest memory address stores the most significant byte (referred to as the “big end”) of a multi-byte data type, while subsequent bytes store in decreasing order of significance. That is, the most significant byte comes first.
In this type, it would be stored as 12 34 56 78 in memory, with the most significant byte 12 stored at the lowest memory address.
Little Type
In a Little type system, multi-byte data types store the least significant byte (referred to as the “little end”) at the lowest memory address, with subsequent bytes arranged in increasing order of significance. That is, the least significant byte comes first.
In Little Type, it would be stored as 78 56 34 12 in memory, with the least significant byte 78 stored at the lowest memory address.
Example-1: Understanding of Little Endian and Big Endian
Lets assume the value 0x01234567 (4Byte Data) will be going to store in Memory.