dsp.h: collect gcc/clang version test macros

endian_inl.h already relies on dsp.h, grab the definitions from there.

(cherry picked from commit 8323a9038d)

Change-Id: I445f7d0631723043c55da1070498f89965bec7b1
This commit is contained in:
James Zern 2014-08-27 19:33:09 -07:00
parent 90d112466b
commit 5af7719047
2 changed files with 12 additions and 14 deletions

View File

@ -32,9 +32,19 @@ extern "C" {
# define LOCAL_GCC_PREREQ(maj, min) \ # define LOCAL_GCC_PREREQ(maj, min) \
(LOCAL_GCC_VERSION >= (((maj) << 8) | (min))) (LOCAL_GCC_VERSION >= (((maj) << 8) | (min)))
#else #else
# define LOCAL_GCC_VERSION 0
# define LOCAL_GCC_PREREQ(maj, min) 0 # define LOCAL_GCC_PREREQ(maj, min) 0
#endif #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 && \ #if defined(_MSC_VER) && _MSC_VER > 1310 && \
(defined(_M_X64) || defined(_M_IX86)) (defined(_M_X64) || defined(_M_IX86))
#define WEBP_MSC_SSE2 // Visual C++ SSE2 targets #define WEBP_MSC_SSE2 // Visual C++ SSE2 targets

View File

@ -35,25 +35,13 @@
#endif #endif
#if !defined(HAVE_CONFIG_H) #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 // 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_BSWAP32
#define HAVE_BUILTIN_BSWAP64 #define HAVE_BUILTIN_BSWAP64
#endif #endif
// clang-3.3 and gcc-4.8 have a builtin function for swap16 // 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 #define HAVE_BUILTIN_BSWAP16
#endif #endif
#endif // !HAVE_CONFIG_H #endif // !HAVE_CONFIG_H