Store ordering used in to store data in memory
 

Possible store ordering of data:

  Ordering in a register:

    +--------+--------+--------+--------+
    | byte 1 | byte 2 | byte 3 | byte 4 |
    +--------+--------+--------+--------+

  Possoible store orderings in memory:

   (1) Left-to-right order    (2) Right-to-left order

   Memory:+--------+        Memory:+--------+
          | byte 1 | |		   | byte 4 | ^
          +--------+ |             +--------+ |
          | byte 2 | |		   | byte 3 | |
          +--------+ |             +--------+ |
          | byte 3 | |		   | byte 2 | |
          +--------+ |             +--------+ |
          | byte 4 | V		   | byte 1 | |
          +--------+               +--------+
   

The str instruction that uses the big endian ordering
 

The big endian ordering will store the bytes from left-to-right in memory (the most-significant byte first):

The ldr instruction that uses the big endian ordering
 

The big endian ordering will load the bytes from left-to-right from memory (the most-significant byte first):

The str instruction that uses the little endian ordering
 

The little endian ordering will store the bytes from right-to-left in memory (the least-significant byte first):

The ldr instruction that uses the little endian ordering
 

The little endian ordering will load the bytes from right-to-left from memory (the least-significant byte first):

Choice of store ordering
 

The choice of store ordering is manufacturer dependent:

  • The INTEL processors (x86) uses little endian ordering

  • The ARM processor uses little endian by default

    • ARM can be programmed to operate as big endian

  • Most processors use big endian, such as:

    • Motorola M68000
    • SPARC by SunMicro Systems)
    • PowerPC (by Apple)

 

Which store ordering is better ?
 

  • The store ordering has no effect on processor performance or any other performance factor.

      • As long as the processor retrieve the bytes stored in the memory in the same ordering as the processor stores the bytes, the load and store instructions will work correctly and with the same efficiency

  • So store ordering is a matter of "taste"

Origin of the terminology "Big endian" and "Little endian"
 

Gulliver's Travels (a satire by Jonathan Swift)

  • Lilliput was the land of tiny humans in Gulliver's travel

  • There used to be a practice to break eggs at the big end

  • When a king hurt himself, he imposed a law in Lilliput:

      • Eggs are be broken at the little end       

  • However, some people in Lilliput still kept the old practice:

      • The Liliputters who continued to break their eggs at the big end were called: Big Endians