What is Big endian and little-endian mode

  • Big endian (big endian): Low (bytes / bits) in upper address, the upper (bytes / bits) in the lowest address.
  • Little endian (little endian): Low (bytes / bits) in low address, high (byte / bit) in the high address.
  • In serial communications port and the like, you can only send one byte. This time encountered a problem. int type has 4 bytes. We are sending byte do and in what order. The sender and receiver must communicate in the same byte order. This is the end of mode size in a communication system.
  • Now we are talking about the size of the end of the model say more is the size of the client computer storage systems. In computer memory / hard disk / Nnad in. Because the storage system 32, but is still in accordance with the data bytes, then there are two distributed manner when a 32-bit binary stored in memory.
  • High Low High Low address address.
  • High upper address corresponding to: big-endian storage mode.
  • High Low address: little endian storage mode.
  • Big endian and little-endian mode itself is not good or bad. According to the same end of the pattern size, but an error it would otherwise be required to store and retrieve.
  • The reality is that some companies with big-endian cpu (c51), some with small end (arm, intal). Most small side, not a lot of big-endian mode.

Example:

1) big-endian mode:

Low address -----------------> High address
0x12 | 0x34 | 0x56 | 0x78

2) little-endian mode:

Low address ------------------> High address
0x78 | 0x56 | 0x34 | 0x12

0x2211 bytes stored using two values: high byte is 0x22, the low byte is 0x11.
Big endian: the high byte, the lower byte, i.e., stored in the form of 0x2211.
Little-endian: low byte first, high byte after that is stored in the form of 0x1122.


 

Published 141 original articles · won praise 33 · views 50000 +

Guess you like

Origin blog.csdn.net/qq_43560721/article/details/102839042