aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/x86/intmath.h
diff options
context:
space:
mode:
authorMatt Oliver <protogonoi@gmail.com>2015-10-16 17:00:13 +1100
committerMatt Oliver <protogonoi@gmail.com>2015-10-19 13:40:51 +1100
commitb0bb1dc62d40dc385283f309012f64d0987883eb (patch)
treed26ee6556cbfdce8e4d18cc427eca398ba829f67 /libavutil/x86/intmath.h
parent216cc1f6fe33b256ce708fade5e6638b2bb54d2b (diff)
downloadffmpeg-b0bb1dc62d40dc385283f309012f64d0987883eb.tar.gz
lavu/intmath.h: Move x86 only msvc/icl functions to x86 specific header.
Signed-off-by: Matt Oliver <protogonoi@gmail.com>
Diffstat (limited to 'libavutil/x86/intmath.h')
-rw-r--r--libavutil/x86/intmath.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
index 3ba5ed072c..7881e3c7b6 100644
--- a/libavutil/x86/intmath.h
+++ b/libavutil/x86/intmath.h
@@ -26,6 +26,11 @@
#if HAVE_FAST_CLZ
#if defined(__INTEL_COMPILER)
+# define ff_log2(x) (_bit_scan_reverse((x)|1))
+# define ff_log2_16bit av_log2
+
+# define ff_ctz(v) _bit_scan_forward(v)
+
# define ff_ctzll ff_ctzll_x86
static av_always_inline av_const int ff_ctzll_x86(long long v)
{
@@ -38,6 +43,21 @@ static av_always_inline av_const int ff_ctzll_x86(long long v)
# endif
}
#elif defined(_MSC_VER)
+# define ff_log2 ff_log2_x86
+static av_always_inline av_const int ff_log2_x86(unsigned int v) {
+ unsigned long n;
+ _BitScanReverse(&n, v | 1);
+ return n;
+}
+# define ff_log2_16bit av_log2
+
+# define ff_ctz ff_ctz_x86
+static av_always_inline av_const int ff_ctz_x86(int v) {
+ unsigned long c;
+ _BitScanForward(&c, v);
+ return c;
+}
+
# define ff_ctzll ff_ctzll_x86
static av_always_inline av_const int ff_ctzll_x86(long long v)
{