Use built-in byte swap functions on LLVM

This commit is contained in:
Luke Street 2015-08-17 11:36:46 -04:00
parent 556fbe1d82
commit c3c94c6574

View File

@ -24,6 +24,7 @@ typedef uint8_t u8;
#define __ORDER_BIG_ENDIAN__ BIG_ENDIAN
#endif
#ifndef __llvm__
static inline uint16_t __builtin_bswap16(uint16_t x)
{
return ((x << 8) & 0xff00) | ((x >> 8) & 0x00ff);
@ -43,6 +44,7 @@ static inline uint64_t __builtin_bswap64(uint64_t x)
((uint64_t)__builtin_bswap32(x&0xFFFFFFFF) << 32);
}
#endif
#endif
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define be_dword(a) __builtin_bswap64(a)