diff --git a/src/dsp/dsp.h b/src/dsp/dsp.h index 1fbe6adf..7dc09e03 100644 --- a/src/dsp/dsp.h +++ b/src/dsp/dsp.h @@ -32,9 +32,19 @@ extern "C" { # define LOCAL_GCC_PREREQ(maj, min) \ (LOCAL_GCC_VERSION >= (((maj) << 8) | (min))) #else +# define LOCAL_GCC_VERSION 0 # define LOCAL_GCC_PREREQ(maj, min) 0 #endif +#ifdef __clang__ +# define LOCAL_CLANG_VERSION ((__clang_major__ << 8) | __clang_minor__) +# define LOCAL_CLANG_PREREQ(maj, min) \ + (LOCAL_CLANG_VERSION >= (((maj) << 8) | (min))) +#else +# define LOCAL_CLANG_VERSION 0 +# define LOCAL_CLANG_PREREQ(maj, min) 0 +#endif // __clang__ + #if defined(_MSC_VER) && _MSC_VER > 1310 && \ (defined(_M_X64) || defined(_M_IX86)) #define WEBP_MSC_SSE2 // Visual C++ SSE2 targets diff --git a/src/utils/endian_inl.h b/src/utils/endian_inl.h index f7061ba9..cd56c37f 100644 --- a/src/utils/endian_inl.h +++ b/src/utils/endian_inl.h @@ -35,25 +35,13 @@ #endif #if !defined(HAVE_CONFIG_H) -#ifdef __GNUC__ -# define LOCAL_GCC_VERSION ((__GNUC__ << 8) | __GNUC_MINOR__) -#else -# define LOCAL_GCC_VERSION 0 -#endif // __GNUC__ - -#ifdef __clang__ -# define LOCAL_CLANG_VERSION ((__clang_major__ << 8) | __clang_minor__) -#else -# define LOCAL_CLANG_VERSION 0 -#endif // __clang__ - // clang-3.3 and gcc-4.3 have builtin functions for swap32/swap64 -#if LOCAL_GCC_VERSION >= 0x403 || LOCAL_CLANG_VERSION >= 0x303 +#if LOCAL_GCC_PREREQ(4,3) || LOCAL_CLANG_PREREQ(3,3) #define HAVE_BUILTIN_BSWAP32 #define HAVE_BUILTIN_BSWAP64 #endif // clang-3.3 and gcc-4.8 have a builtin function for swap16 -#if LOCAL_GCC_VERSION >= 0x408 || LOCAL_CLANG_VERSION >= 0x303 +#if LOCAL_GCC_PREREQ(4,8) || LOCAL_CLANG_PREREQ(3,3) #define HAVE_BUILTIN_BSWAP16 #endif #endif // !HAVE_CONFIG_H