1 static union { char c[4]; unsigned long mylong; } endian_test = {{ ‘l‘, ‘?‘, ‘?‘, ‘b‘ } }; 2 3 #define ENDIANNESS ((char)endian_test.mylong)
如果ENDIANNESS=’l’表示系统为little endian,
为’b’表示big endian
时间: 2024-10-17 18:01:05
1 static union { char c[4]; unsigned long mylong; } endian_test = {{ ‘l‘, ‘?‘, ‘?‘, ‘b‘ } }; 2 3 #define ENDIANNESS ((char)endian_test.mylong)
如果ENDIANNESS=’l’表示系统为little endian,
为’b’表示big endian