Big-endia and little-Endian

Source: Internet
Author: User

Big endian and little endian

Big endian and little endian are different ways for CPUs to process the number of multi-word segments. For example, the Unicode code of the Chinese character is 6c49. When I write a file, do I write 6C in front or 49 in front? If you write 6C in front, it is big endian. Write 49 in front, that is, little endian.

The word "endian" comes from Gulliver Travel Notes. The civil war in the minor people's country originated from the fact that the big-Endian attack or the little-Endian attack were initiated when the eggs were eaten. As a result, there were six rebels, one of the emperors gave life and the other lost the throne.

We generally translate endian into byte order, and call Big endian and little endian "Big tail" and "Small Tail ".

Big-Endian: a wordHighByte is placed at the lowest address of the word in the memory segment.

Little-Endian: a wordLow LevelByte is placed in the lowest address of the word in the memory segment)

 

The so-called Big-end mode stores low data points in the high address of the memory, while the high data points are stored in the low address of the memory. The so-called small-end Mode, is the low position of the index data stored in the low address of the memory, and the high position of the data is stored in the high address of the memory

Short int X;

Char x0, x1;

X = 0x1122;

X0 = (char *) & X) [0]; // low address Unit
X1 = (char *) & X) [1]; // high address Unit

If X0 = 0x11, it is a large end. If X0 = 0x22, it is a small end ......

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.