Linux判断大小尾数(big-endian,little-endian)的方法

static union
{
  char c[4];
  unsigned char l;
} endian_test={ {'l','?','?','b'} }
#define ENDIANNESS ( (char)endian_test.l )

if (ENDIANNESS == 'l')
//little endian
else
//big endian



http://www.cnblogs.com/leezhm/archive/2011/07/19/2110864.html

你可能感兴趣的:(c)