Big Endian and Little Endian


All computers do not store the bytes that comprise a multi-byte value in the same order. Consider a 16-bit internet that is made up of 2 bytes. Two ways to store this value −

  • Little Endian − In this scheme, low-order byte is stored on the starting address (A) and high-order byte is stored on the next address (A + 1).

  • Big Endian − In this scheme, high-order byte is stored on the starting address (A) and low-order byte is stored on the next address (A + 1).

To allow machines with different byte order conventions communicate with each other, the Internet protocols specify a canonical byte order convention for data transmitted over the network. This is known as Network Byte Order.

By these definitions, a 32-bit data pattern, which is regarded as a 32-bit unsigned integer. The "high- Order" byte is the one for the largest powers of 2: 231, ..., 224. The "low-order" byte is the one for the smallest powers of 2: 27, ..., 20.

Example

0x12674592 in 32-bit representation can be stored as −

raja
Published on 11-Oct-2019 16:44:23
Advertisements