#1,082 – Big-endian and Little-endian

The terms “big-endian” and “little-endian” refer to the scheme that a computer uses to store binary data in memory.  The basic difference is:

  • Big-endian (e.g. IBM mainframes, Motorola 68000) – leftmost byte is stored first, followed by other bytes, left-right.  (“Big end” of number stored first)
  • Little-endian (e.g. Intel processors) – rightmost byte is stored first, followed by other bytes, right-left.  (“Little end” of number stored first)

Below is an example.  Assume that have a 4-byte (32-bit) number with a value of 0x1234ABCD (hex).  The diagram below shows how this number would be stored in a 4-byte chunk of memory, based on whether the processor uses the big-endian or the little-endian convention.

1082-001

 

Advertisement