#define get_u8_0(x) ((U8*)&x)[0]
#define get_u8_1(x) ((U8*)&x)[1]
#define get_u8_2(x) ((U8*)&x)[2]
#define get_u8_3(x) ((U8*)&x)[3]
U32 test = 0x12345678;
U8 a,b,c,d;
a = get_u8_0(test); // 0x12
b = get_u8_1(test); // 0x34
c = get_u8_2(test); // 0x56
d = get_u8_3(test); // 0x78
以上结果针对KEIL C51 |