The end pattern is divided into small-endian byte-order and big-end byte-order, which is the sequence of bytes in memory.
It is important to Note that for data, the high byte is the highest bit byte, which is the first bit on the left!
Small endian: Low bytes are stored in low memory addresses, and high bytes are stored in high memory addresses. such as a long type data 0x12345678
0x0029f458 0x78
0x0029f459 0x56
0x0029f45a 0x34
0x0029f45b 0x12
In the representation of the above data in memory, 0x0029f458 < 0x0029f459 < 0x0029f45a < 0x0029f45b,
It can be known that the memory address is from low to high order, and the data byte is from low to high, so the above byte order is the small endian.
Big endian byte order: High byte is stored in low memory address, low byte is stored in memory high address.
0x0029f458 0x12
0x0029f459 0x34
0x0029f45a 0x56
0x0029f45b 0x79
In the representation of the above data in memory, 0x0029f458 < 0x0029f459 < 0x0029f45a < 0x0029f45b,
It can be known that the memory address is from low to high order, and the data bytes are from high to low, so the above byte order is the big endian byte order.
network byte order: is the big endian byte order. Specifies that the network byte order is used for communication between different systems.
The experiment in VC is as follows:
int temp = 0x12345678;
In debugging, the variable in memory byte data is 78 56 34 12, in memory the storage address is: 0x0029f458,0x0029f459,
0X0029F45A,0X0029F45B, just meet the low in the lower address, indicating that the VC follows the small-endian byte sequence.
From: http://www.cnblogs.com/xiehy/archive/2010/11/25/1887779.html
Small end byte order and big endian byte order