//C++ #include <arpa/inet.h> uint32_t htonl(uint32_t buffer); // 32位 uint16_t htons(uint16_t buffer); // 16位
Linux上,无符号c++版
#define __SWP16(A) (( ((uint16)(A) & 0xff00) >> 8) | \ (( (uint16)(A) & 0x00ff) << 8)) #define __SWP32(A) ((( (uint32)(A) & 0xff000000) >> 24) | \ (( (uint32)(A) & 0x00ff0000) >> 8) | \ (( (uint32)(A) & 0x0000ff00) << 8) | \ (( (uint32)(A) & 0x000000ff) << 24))
c语言版
标签:c51,16,buffer,C语言,uint16,uint32 From: https://www.cnblogs.com/fdd-lte/p/17498073.html