Which of the small-endian model is more in line with human thought?

Source: Internet
Author: User

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 TD align= "left" valign= "middle" width= "189" >
; big-endian mode ; small end mode
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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.