aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/x86/intmath.h
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2025-03-31 14:02:36 +0200
committerMartin Storsjö <martin@martin.st>2025-06-12 14:17:37 +0300
commit43dc443446e48614323bd1f083e90ae11ea66827 (patch)
treeae3b68d077fba54486b12b6e5d9ec2e290850456 /libavutil/x86/intmath.h
parentf019dd69f0f5ecd89add139784cf37148af56bd0 (diff)
downloadffmpeg-43dc443446e48614323bd1f083e90ae11ea66827.tar.gz
avutil/intmath: use AV_HAS_BUILTIN to detect builtin availability
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. Signed-off-by: Kacper Michajłow <kasper93@gmail.com> Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavutil/x86/intmath.h')
-rw-r--r--libavutil/x86/intmath.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
index 735945ca95..d8d1f19b24 100644
--- a/libavutil/x86/intmath.h
+++ b/libavutil/x86/intmath.h
@@ -66,7 +66,7 @@ static av_always_inline av_const int ff_ctzll_x86(long long v)
#endif /* HAVE_FAST_CLZ */
-#if defined(__GNUC__)
+#if defined(__GNUC__) || defined(__clang__)
/* Our generic version of av_popcount is faster than GCC's built-in on
* 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)
#if defined(__BMI2__)
-#if AV_GCC_VERSION_AT_LEAST(5,1)
+#if AV_GCC_VERSION_AT_LEAST(5,1) || AV_HAS_BUILTIN(__builtin_ia32_bzhi_si)
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
#define av_zero_extend av_zero_extend_bmi2
static av_always_inline av_const unsigned av_zero_extend_bmi2(unsigned a, unsigned p)