大端和小端的存储方式

参考 http://blog.csdn.net/favory/article/details/4441361

从低地址------->高地址

小端(llittle endian) 低字节------->高字节

大端(big endian)   高字节------->低字节

在一个处理器系统中,有可能存在大端和小端模式同时存在的现象

这一现象为系统的软硬件设计带来了不小的麻烦,这要求系统设计工程师,必须深入理解大端和小端模式的差别

大端与小端模式的差别体现在一个处理器的寄存器,指令集,系统总线等各个层次中

系统中大小端的测试

int main(void)
{
  unsigned short test = 0x1234;

  if(*( (unsigned char*) &test ) == 0x12)
    printf("big endian ");
  else
    printf("little endian ");
}

原文地址:https://www.cnblogs.com/Deanboy/p/7525917.html