use gcc __builtin_bswap16 to byteswap 16-bit values

__builtin_bswap16 is available since gcc4.8.
pull/62/head
Hans-Erik Floryd 2019-07-10 12:25:13 +02:00
parent f0a378382e
commit c8575b795f
1 changed files with 1 additions and 1 deletions

View File

@ -43,7 +43,7 @@ extern "C"
#define CC_DEPRECATED __attribute__((deprecated))
#define CC_SWAP32(x) __builtin_bswap32 (x)
#define CC_SWAP16(x) ((uint16_t)(x) >> 8 | ((uint16_t)(x) & 0xFF) << 8)
#define CC_SWAP16(x) __builtin_bswap16 (x)
#define CC_ATOMIC_SET(var,val) __atomic_store_n(&var,val,__ATOMIC_SEQ_CST)
#define CC_ATOMIC_GET(var) __atomic_load_n(&var,__ATOMIC_SEQ_CST)