Use built-in byte swap functions on LLVM
This commit is contained in:
parent
556fbe1d82
commit
c3c94c6574
@ -24,6 +24,7 @@ typedef uint8_t u8;
|
|||||||
#define __ORDER_BIG_ENDIAN__ BIG_ENDIAN
|
#define __ORDER_BIG_ENDIAN__ BIG_ENDIAN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __llvm__
|
||||||
static inline uint16_t __builtin_bswap16(uint16_t x)
|
static inline uint16_t __builtin_bswap16(uint16_t x)
|
||||||
{
|
{
|
||||||
return ((x << 8) & 0xff00) | ((x >> 8) & 0x00ff);
|
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);
|
((uint64_t)__builtin_bswap32(x&0xFFFFFFFF) << 32);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||||
#define be_dword(a) __builtin_bswap64(a)
|
#define be_dword(a) __builtin_bswap64(a)
|
||||||
|
Loading…
Reference in New Issue
Block a user