big endian VS little endian

big endian VS little endian   8086机器都是使用little endian, 而摩托罗拉的power pc使用big endian,对于一个数0x1122产用little endian方式时   低字节存储0x22,高字节存储0x11. 而使用big endian方式时,  低字节存储0x11, 高字节存储0x22 在这俩种字节方式间转换可以使用汇编指令 BSWAP

测试函数

 int IsBigEndian()

{       

  unsigned short test = 1;       

       return (*((unsigned char  *)&test) == 0);

 }

原文地址:https://www.cnblogs.com/liyulong1982/p/2330199.html