Host byte sequence is generally divided into big-endian and small-end two, in the X86 platform generally adopt small-end mode. (The use of big-endian data storage in line with human normal thinking, and the use of small-end method of data storage is conducive to computer processing.) )
The "Small End" and "big endian" indicate which end of the multibyte value (small or big) is stored at the starting address of the value. The small end has the starting address, that is, the small-endian byte-order;
1. The small-end method (Little-endian) is the low-level byte emissions at the lower address of the memory is the starting address of the value, high-bit bytes emitted in the memory of the higher address.
2. The big-endian method (Big-endian) is High byte Emissions at the low address end of the memory is the starting address of the value, and the low byte is emitted at the high address end of the memory.
If a 32-bit integer 0x12345678 is stored in an integer variable (int), this integer variable is stored in memory by the big-endian or small-end pattern, as shown in the following table. Here OP0 represents the highest byte MSB (most significant byte) of a 32-bit data, using OP3 to represent a 32-bit data minimum byte LSB (Least significant byte).
; address offset |
; big-endian mode |
; Small terminal mode |
0x00 |
(OP0) |
(OP3) |
0x01 |
(OP1) |
(OP2) |
0x02 |
(OP2) |
(OP1) |
0x03 |
(OP3) |
(OP0) |
0x00
|
; big-endian mode |
; small end mode |
TD align= "left" valign= "middle" width= "189" >
12 (OP0) |
34 (OP1) |
0x01 |
34 (OP1) |
12 (OP0) |
As is known from the above table, the main difference between the data storage in the size mode is the byte order in which the big end is stored in the low address, and the small-ended method stores the high-level address. The use of big-endian data storage in line with human normal thinking, and the use of small-end method of data storage is conducive to computer processing. So far, the use of big-endian or small-end data storage, the merits of the pros and cons are inconclusive. Some processor systems use a small-end approach for data storage, such as Intel's Pentium. Some processor systems use a big-endian approach for data storage, such as IBM Semiconductors and Freescale PowerPC processors. Not only for the processor, some peripheral design also has the use of big-endian or small-end data storage options. refer to: http://dwz.cn/2KbK1g
Which of the small-endian model is more in line with human thought?