-
Different processors store multibyte integers in different orders in memory.
-
There are two popular methods of storing integers: big endian and little indian.
-
Big endian method is the most natural:
-
IBM mainframes, most RISC processors and Motorola processors all use this big endian method.
-
However, Intel-based processors use the little endian method, in which the least significant byte is stored first.
-
Normally, the programmer does not need to worry about which format is used, unless
-
Binary data is transfered between different computers e.g. over a network.
-
Binary data is written out to memory as a multibyte integer and then read back as individual bytes or vise versa.
-
Endianness does not apply to the order of array elements.
-
See also: wikipedia article about
endianness
.
|
|