diff options
-rw-r--r-- | Utilities/cmlibrhash/librhash/byte_order.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Utilities/cmlibrhash/librhash/byte_order.h b/Utilities/cmlibrhash/librhash/byte_order.h index 59a6c23..a43906c 100644 --- a/Utilities/cmlibrhash/librhash/byte_order.h +++ b/Utilities/cmlibrhash/librhash/byte_order.h @@ -85,6 +85,10 @@ void rhash_swap_copy_str_to_u64(void* to, int index, const void* from, size_t le void rhash_swap_copy_u64_to_str(void* to, const void* from, size_t length); void rhash_u32_mem_swap(unsigned *p, int length_in_u32); +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif + /* define bswap_32 */ #if defined(__GNUC__) && defined(CPU_IA32) && !defined(__i386__) /* for intel x86 CPU */ @@ -95,6 +99,8 @@ static inline uint32_t bswap_32(uint32_t x) { #elif defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3) /* for GCC >= 4.3 */ # define bswap_32(x) __builtin_bswap32(x) +#elif defined(__clang__) && __has_builtin(__builtin_bswap32) +# define bswap_32(x) __builtin_bswap32(x) #elif (_MSC_VER > 1300) && (defined(CPU_IA32) || defined(CPU_X64)) /* MS VC */ # define bswap_32(x) _byteswap_ulong((unsigned long)x) #elif !defined(__STRICT_ANSI__) @@ -110,6 +116,8 @@ static inline uint32_t bswap_32(uint32_t x) { #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3) # define bswap_64(x) __builtin_bswap64(x) +#elif defined(__clang__) && __has_builtin(__builtin_bswap64) +# define bswap_64(x) __builtin_bswap64(x) #elif (_MSC_VER > 1300) && (defined(CPU_IA32) || defined(CPU_X64)) /* MS VC */ # define bswap_64(x) _byteswap_uint64((__int64)x) #elif !defined(__STRICT_ANSI__) |