About big endian byte order and small end byte order

Source: Internet
Author: User

Most computers are now addressed in bytes (except by byte addressing and by-word addressing and bitwise addressing). So this is the only computer that addresses bytes.


Big endian byte order: High bytes of data are kept at low addresses.

Small endian: High bytes of data are saved at high addresses.


The memory in the computer can be considered linear (this is only discussed in bytes), as shown in the following illustration:


As can be seen from the figure above, an int is a 16-bit, or two-byte length, which can represent the memory of 2^16byte (aka 64KB).


Now let's take a look at how an int is stored in the big and small ends, respectively.

As an example:

We now have an integer of 258. The 16 notation is 0x0102, then we split the integer into two bytes, the first byte is 0x01, the second byte is 0x02.

The corresponding binary numbers are: 0000 0001 and 0000 0010 respectively.

If you are on a computer that uses a big-endian byte sequence, this integer will be stored like this:



This is the same byte sequence that we teach in class. Both are high in low address.

If a computer using a small-endian byte sequence, the high byte of this integer will be stored on the high address:


The low-byte portion of the int is programmed with the content of the address carefully, which is 0000 0010.

These are the differences between the big and small end computers in storing data.

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.