Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2016-01-03 22:14:37 +0300
committerClément Bœsch <u@pkh.me>2016-01-08 00:51:31 +0300
commit2ce29d17656fab36286a76a9bb68e001e2815a3d (patch)
treec57b323873ec1c45ec8ab07d1ea36bbe1c86a507 /libavutil/intmath.h
parentd64fe951c2ee8a85c615c33490889f45c4663862 (diff)
lavu: add ff_parity()
Diffstat (limited to 'libavutil/intmath.h')
-rw-r--r--libavutil/intmath.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavutil/intmath.h b/libavutil/intmath.h
index 82193a6d7c..17c4f1b48a 100644
--- a/libavutil/intmath.h
+++ b/libavutil/intmath.h
@@ -153,6 +153,18 @@ static av_always_inline av_const unsigned ff_clz_c(unsigned x)
}
#endif
+#ifndef ff_parity
+#define ff_parity ff_parity_c
+static av_always_inline av_const int ff_parity_c(uint32_t v)
+{
+#if HAVE_PARITY
+ return __builtin_parity(v);
+#else
+ return av_popcount(v) & 1;
+#endif
+}
+#endif
+
/**
* @}
*/