Small top pile, big Top pile

Source: Internet
Author: User

What is a byte order

In different computer architectures, the storage and transmission mechanisms of data (bits, bytes, words) are different, which leads to a potential but very important problem in the field of computers, that is, the communication units of the communicating parties should be transmitted in what order. If there is no consistent rule, the communication and storage of the computer will not be possible. There are two main types of byte storage mechanisms commonly used in computers in various systems: big-endian (Big-endian) and small-end (Little-endian). In this case, the big-endian and the small end are the byte-order.

MSB and LSB
    • The MSB is the acronym for most significant bit/byte, often translated into the most important bits or most important bytes. It is typically used to denote the bit/byte that has the greatest impact on the entire sequence in a bit sequence (such as a byte that is a sequence of 8 bits) or a byte sequence (such as word is a sequence of two bytes).

    • The LSB is an acronym for the least significant bit/byte, which is often translated as the least important bit or the least important byte. It is usually used to indicate the bit/byte that has the least effect on the entire sequence in a bit sequence (such as a byte that is a sequence of 8 bits) or a byte sequence (such as word is a sequence of two bytes).

    • For a hexadecimal int type integer 0x12345678, 0x12 is msb,0x78 is the LSB. For 0x78 this byte, its binary is 01111000, then the leftmost 0 is the MSB, the rightmost 0 is the LSB.

Big-endian sequence
    • The big endian is also called the network byte order. The big endian specifies that the high-order byte is placed at the low address at the time of storage, the high byte is placed at the beginning of the stream when it is stored, and the low byte is placed at the high address at the time of transmission, and the low byte is placed at the end of the stream.

Small end sequence
    • The small end sequence specifies that the high-order byte is placed at the higher address at the time of storage, and the high byte is placed at the end of the stream when it is stored, and the lower byte is placed at the low address at the time of transmission, and the low byte is placed at the beginning of the stream.

Network byte order
    • The network byte order refers to the big-endian sequence. TCP/IP is in the form of network byte order, and Java is stored using the big-endian method.

Host byte order
    • The host byte order represents the byte order of the native. It's usually small, but there are some big-endian sequences.

    • The host byte order is used in the protocol description to refer to the small end sequence.

Summarize
    • The byte order is only for multi-byte types of data. For example, int type integer 0x12345678, it occupies 4 bytes of storage space, storage methods have big-endian (0x12, 0x34, 0x56, 0x78) and small end (0x78, 0x56, 0x34, 0x12) two kinds. As you can see, in the storage mode of the big or small end, it is in bytes. So for a single-byte type of data, there is no byte-order argument.

Small top pile, big Top pile

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.