diff --git a/src/core/bitmath_func.hpp b/src/core/bitmath_func.hpp index 6e39121563..96654281ae 100644 --- a/src/core/bitmath_func.hpp +++ b/src/core/bitmath_func.hpp @@ -404,12 +404,12 @@ static inline T ROR(const T x, const uint8 n) */ static inline uint32 BSWAP32(uint32 x) { -#if !defined(__ICC) && defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ >= 3)) +#if !defined(__ICC) && (defined(__GNUC__) || defined(__clang__)) /* GCC >= 4.3 provides a builtin, resulting in faster code */ return (uint32)__builtin_bswap32((int32)x); #else return ((x >> 24) & 0xFF) | ((x >> 8) & 0xFF00) | ((x << 8) & 0xFF0000) | ((x << 24) & 0xFF000000); -#endif /* defined(__GNUC__) */ +#endif /* __GNUC__ || __clang__ */ } /** diff --git a/src/stdafx.h b/src/stdafx.h index 6468346fa6..74f4879726 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -523,7 +523,7 @@ static inline void free(const void *ptr) #if defined(_MSC_VER) #define INCLUDE_FOR_PREFETCH_NTA #define PREFETCH_NTA(address) _mm_prefetch((const char *) (address), _MM_HINT_NTA); -#elif defined(__GNUC__) +#elif defined(__GNUC__) || defined(__clang__) #define INCLUDE_FOR_PREFETCH_NTA "stdafx.h" #define PREFETCH_NTA(address) __builtin_prefetch((const void *) (address), 0, 0); #else