宏实现大小端互换

//短整形高低字节交换
#define Swap16(A) ((((uint16)(A) & 0xff00) >> 8) | (((uint16)(A) & 0x00ff) << 8))
//长整形高低字节交换
#define Swap32(A) ((((uint32)(A) & 0xff000000) >> 24) |
(((uint32)(A) & 0x00ff0000) >> 8) |
(((uint32)(A) & 0x0000ff00) << 8) |
(((uint32)(A) & 0x000000ff) << 24))

你可能感兴趣的:(C++)