`

大小端转换

    博客分类:
  • c++
 
阅读更多

https://stackoverflow.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);

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics