Data storage mode: Big-end mode and small-end mode.
CPU and data in different architectures are stored in different order in the memory.
The storage of data in memory is based on bytes. Therefore, Word and Half-Word are stored in two orders: big Endian and Little Endian ).
Small-end Storage refers to the storage of low data bytes at low memory addresses, and the storage of high data bytes includes high data bytes;
Large-end Storage refers to the storage of Low-byte data at the Internal High address, and the high-byte data is stored at the low-byte memory;
Typedef unsigned long u32; typedef unsigned short 2010; typedef unsigned char u8; int main (void) {u8 I; u32 data = 0x78563412; u8 * p = (u8 *) & data; for (I = 0; I <4; I ++) {printf ("% # x", p); printf ("% # x \ n ", * p); p ++;} return 0 ;} /*************************************** * ******** the output result in VC ++ 6.0 is: 0x18ff40 0x120x18ff41 0x340x18ff42 0x560x18ff43 0x78Press any key to continue ******************************* ******************/
Note the following:
(1) data is stored in large-end mode in registers.
(2) data stored in Small-end mode in memory. When CPU access is counted, the conversion between the small end and the big end is achieved through hardware, without the overhead of Data Loading/storage.