Endian
Contents
Little Endian
A number showed in Little Endian format means that the low order of the number is stored at the lowest address in memory, and the high order byte at the highest address. This format is by design used by Intel CPU.
Example
The word value 33000 (decimal), 80E8 (hex) is stored:
Base address + 0 = E8 Base address + 1 = 80
If we transmit it over a stream:
First byte = E8 Second byte = 80
Big Endian
A number showed in Big Endian format means that the high order of the number is stored at the lowest address in memory, and the low order byte at the highest address. This format is by design used by Motorola CPU.
Example
The word value 33000 (decimal), 80E8 (hex) is stored:
Base address + 0 = 80 Base address + 1 = E8
If we transmit it over a stream:
First byte = 80 Second byte = E8
Sending numbers over a stream
It is common habitude to send numbers in Big Endian over a stream. This because it is better human read.
History
The terms big endian and little endian are derived from the Lilliputians of Gulliver's Travels, whose major political issue was whether soft boiled eggs should be opened on the big side or the little side.
Code conversion
function ChangeEndian(Number: integer): integer; asm bswap eax end;