[FFmpeg-devel] [PATCH 1/2] libavutil: add av_mod_uintp2
James Almer
jamrial at gmail.com
Thu Mar 19 06:34:26 CET 2015
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavutil/common.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/libavutil/common.h b/libavutil/common.h
index 852c1de..3e62b6d 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -211,6 +211,17 @@ static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
}
/**
+ * Clear high bits from an unsigned integer starting with specific bit position
+ * @param a value to clip
+ * @param p bit position to clip at
+ * @return clipped value
+ */
+static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
+{
+ return a & ((1 << p) - 1);
+}
+
+/**
* Add two signed 32-bit values with saturation.
*
* @param a one value
@@ -466,6 +477,9 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x)
#ifndef av_clip_uintp2
# define av_clip_uintp2 av_clip_uintp2_c
#endif
+#ifndef av_mod_uintp2
+# define av_mod_uintp2 av_mod_uintp2_c
+#endif
#ifndef av_sat_add32
# define av_sat_add32 av_sat_add32_c
#endif
--
2.3.2
More information about the ffmpeg-devel
mailing list