[FFmpeg-devel] [PATCH 1/3] get_bits: add get_bitsz for reading 0-25 bits

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Sun Jan 3 01:35:39 CET 2016


This can be used to simplify code in a couple of places.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavcodec/get_bits.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 0a61c80..f984d3e 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -269,6 +269,14 @@ static inline unsigned int get_bits(GetBitContext *s, int n)
     return tmp;
 }
 
+/**
+ * Read 0-25 bits.
+ */
+static inline int get_bitsz(GetBitContext *s, int n)
+{
+    return n ? get_bits(s, n) : 0;
+}
+
 static inline unsigned int get_bits_le(GetBitContext *s, int n)
 {
     register int tmp;
-- 
2.6.4


More information about the ffmpeg-devel mailing list