mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
Use __has_builtin to check clang support
Older versions of Xcode with clang reporting versions 4.[012] and 5.0
did not include support for __builtin_bswap16. Checking in this manner
avoids using brittle version checks.
Matches a change to libvpx:
https://chromium-review.googlesource.com/305573
to fix:
https://code.google.com/p/webm/issues/detail?id=1082
(cherry picked from commit d26d9def80
)
Change-Id: I23ea466ee1b53b12cd3fb45f65a2186c8dda95a1
This commit is contained in:
parent
e2e89806f7
commit
cd377e291c
@ -36,14 +36,9 @@ extern "C" {
|
|||||||
# define LOCAL_GCC_PREREQ(maj, min) 0
|
# define LOCAL_GCC_PREREQ(maj, min) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifndef __has_builtin
|
||||||
# define LOCAL_CLANG_VERSION ((__clang_major__ << 8) | __clang_minor__)
|
# define __has_builtin(x) 0
|
||||||
# define LOCAL_CLANG_PREREQ(maj, min) \
|
#endif
|
||||||
(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))
|
||||||
|
@ -35,15 +35,15 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_CONFIG_H)
|
#if !defined(HAVE_CONFIG_H)
|
||||||
// clang-3.3 and gcc-4.3 have builtin functions for swap32/swap64
|
#if LOCAL_GCC_PREREQ(4,8) || __has_builtin(__builtin_bswap16)
|
||||||
#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_PREREQ(4,8) || LOCAL_CLANG_PREREQ(3,3)
|
|
||||||
#define HAVE_BUILTIN_BSWAP16
|
#define HAVE_BUILTIN_BSWAP16
|
||||||
#endif
|
#endif
|
||||||
|
#if LOCAL_GCC_PREREQ(4,3) || __has_builtin(__builtin_bswap32)
|
||||||
|
#define HAVE_BUILTIN_BSWAP32
|
||||||
|
#endif
|
||||||
|
#if LOCAL_GCC_PREREQ(4,3) || __has_builtin(__builtin_bswap64)
|
||||||
|
#define HAVE_BUILTIN_BSWAP64
|
||||||
|
#endif
|
||||||
#endif // !HAVE_CONFIG_H
|
#endif // !HAVE_CONFIG_H
|
||||||
|
|
||||||
static WEBP_INLINE uint16_t BSwap16(uint16_t x) {
|
static WEBP_INLINE uint16_t BSwap16(uint16_t x) {
|
||||||
|
Loading…
Reference in New Issue
Block a user