大小端转换 博客分类: c++
程序员文章站
2024-03-19 10:56:10
...
https://*.com/questions/105252/how-do-i-convert-between-big-endian-and-little-endian-values-in-c
GCC 平台 : int32_t __builtin_bswap32 (int32_t x) ;int64_t __builtin_bswap64 (int64_t x)
If you're using Visual C++ do the following: You include intrin.h and call the following functions:
For 16 bit numbers:
unsigned short _byteswap_ushort(unsigned short value);
For 32 bit numbers:
unsigned long _byteswap_ulong(unsigned long value);
For 64 bit numbers:
unsigned __int64 _byteswap_uint64(unsigned __int64 value);