Fixes use of bultins on clang x86_64-pc-windows-msvc which does not define any __GNUC__. Also on other targets __GNUC__ is defined to 4 by default, so any feature testing based on version is not really valid.
Unified · Split
| @@ -35,7 +35,7 @@ · 34 unmodified lines | |||
| 35 | #endif | 35 | #endif |
| 36 | 36 | ||
| 37 | #if HAVE_FAST_CLZ | 37 | #if HAVE_FAST_CLZ |
| 38 | #if AV_GCC_VERSION_AT_LEAST(3,4) | 38 | #if AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_clz) |
| 39 | #ifndef ff_log2 | 39 | #ifndef ff_log2 |
| 40 | # define ff_log2(x) (31 - __builtin_clz((x)|1)) | 40 | # define ff_log2(x) (31 - __builtin_clz((x)|1)) |
| 41 | # ifndef ff_log2_16bit | 41 | # ifndef ff_log2_16bit |
| @@ -90,18 +90,16 @@ static av_always_inline av_const int ff_log2_16bit_c(unsigned int v) · 48 unmodified lines | |||
| 90 | */ | 90 | */ |
| 91 | 91 | ||
| 92 | #if HAVE_FAST_CLZ | 92 | #if HAVE_FAST_CLZ |
| 93 | #if AV_GCC_VERSION_AT_LEAST(3,4) | 93 | #if !defined(ff_ctz) && (AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_ctz)) |
| 94 | #ifndef ff_ctz | ||
| 95 | #define ff_ctz(v) __builtin_ctz(v) | 94 | #define ff_ctz(v) __builtin_ctz(v) |
| 96 | #endif | 95 | #endif |
| 97 | #ifndef ff_ctzll | 96 | #if !defined(ff_ctzll) && (AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_ctzll)) |
| 98 | #define ff_ctzll(v) __builtin_ctzll(v) | 97 | #define ff_ctzll(v) __builtin_ctzll(v) |
| 99 | #endif | 98 | #endif |
| 100 | #ifndef ff_clz | 99 | #if !defined(ff_clz) && (AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_clz)) |
| 101 | #define ff_clz(v) __builtin_clz(v) | 100 | #define ff_clz(v) __builtin_clz(v) |
| 102 | #endif | 101 | #endif |
| 103 | #endif | 102 | #endif |
| 104 | #endif | ||
| 105 | 103 | ||
| 106 | #ifndef ff_ctz | 104 | #ifndef ff_ctz |
| 107 | #define ff_ctz ff_ctz_c | 105 | #define ff_ctz ff_ctz_c |
| @@ -154,7 +152,7 @@ static av_always_inline av_const unsigned ff_clz_c(unsigned x) · 46 unmodified lines | |||
| 154 | } | 152 | } |
| 155 | #endif | 153 | #endif |
| 156 | 154 | ||
| 157 | #if AV_GCC_VERSION_AT_LEAST(3,4) | 155 | #if AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_parity) |
| 158 | #ifndef av_parity | 156 | #ifndef av_parity |
| 159 | #define av_parity __builtin_parity | 157 | #define av_parity __builtin_parity |
| 160 | #endif | 158 | #endif |
| @@ -66,7 +66,7 @@ static av_always_inline av_const int ff_ctzll_x86(long long v) · 65 unmodified lines | |||
| 66 | 66 | ||
| 67 | #endif /* HAVE_FAST_CLZ */ | 67 | #endif /* HAVE_FAST_CLZ */ |
| 68 | 68 | ||
| 69 | #if defined(__GNUC__) | 69 | #if defined(__GNUC__) || defined(__clang__) |
| 70 | 70 | ||
| 71 | /* Our generic version of av_popcount is faster than GCC's built-in on | 71 | /* Our generic version of av_popcount is faster than GCC's built-in on |
| 72 | * CPUs that don't support the popcnt instruction. | 72 | * CPUs that don't support the popcnt instruction. |
| @@ -81,7 +81,7 @@ static av_always_inline av_const int ff_ctzll_x86(long long v) · 8 unmodified lines | |||
| 81 | 81 | ||
| 82 | #if defined(__BMI2__) | 82 | #if defined(__BMI2__) |
| 83 | 83 | ||
| 84 | #if AV_GCC_VERSION_AT_LEAST(5,1) | 84 | #if AV_GCC_VERSION_AT_LEAST(5,1) || AV_HAS_BUILTIN(__builtin_ia32_bzhi_si) |
| 85 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 | 85 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 |
| 86 | #define av_zero_extend av_zero_extend_bmi2 | 86 | #define av_zero_extend av_zero_extend_bmi2 |
| 87 | static av_always_inline av_const unsigned av_zero_extend_bmi2(unsigned a, unsigned p) | 87 | static av_always_inline av_const unsigned av_zero_extend_bmi2(unsigned a, unsigned p) |