mirror of
https://github.com/reactos/CMake.git
synced 2024-11-25 04:29:52 +00:00
librhash: Use __builtin_bswap{32,64} on Clang
This commit is contained in:
parent
af7ebf8ad3
commit
7189d62c32
@ -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__)
|
||||
|
Loading…
Reference in New Issue
Block a user