summaryrefslogtreecommitdiff
path: root/libavutil/common.h
diff options
context:
space:
mode:
authorDaniel Verkamp <daniel@drv.nu>2012-01-03 01:23:48 +0000
committerJanne Grunau <janne-libav@jannau.net>2012-01-03 14:25:43 +0100
commitb73ec0547317fec56a72cda068180f71e12e8f20 (patch)
tree71213e636db5b9bf14b7b70250f45c33439ed312 /libavutil/common.h
parent418f066f8ce35f4a9cc2bea2cbb125a26ca0a003 (diff)
Add av_popcount64
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
Diffstat (limited to 'libavutil/common.h')
-rw-r--r--libavutil/common.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavutil/common.h b/libavutil/common.h
index 7e93a1ab47..c99d858472 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -218,6 +218,16 @@ static av_always_inline av_const int av_popcount_c(uint32_t x)
return (x + (x >> 16)) & 0x3F;
}
+/**
+ * Count number of bits set to one in x
+ * @param x value to count bits of
+ * @return the number of bits set to one in x
+ */
+static av_always_inline av_const int av_popcount64_c(uint64_t x)
+{
+ return av_popcount(x) + av_popcount(x >> 32);
+}
+
#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
@@ -383,3 +393,6 @@ static av_always_inline av_const int av_popcount_c(uint32_t x)
#ifndef av_popcount
# define av_popcount av_popcount_c
#endif
+#ifndef av_popcount64
+# define av_popcount64 av_popcount64_c
+#endif