get_bits: get_bits_long() support n=0 as the docs allow it
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 6 Oct 2012 20:25:04 +0000 (22:25 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 6 Oct 2012 21:04:10 +0000 (23:04 +0200)
also the 0 case is indeed used in some code pathes

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/get_bits.h

index 05ac8f7..a1a48ab 100644 (file)
@@ -302,7 +302,9 @@ static inline void skip_bits1(GetBitContext *s)
  */
 static inline unsigned int get_bits_long(GetBitContext *s, int n)
 {
-    if (n <= MIN_CACHE_BITS)
+    if (!n) {
+        return 0;
+    } else if (n <= MIN_CACHE_BITS)
         return get_bits(s, n);
     else {
 #ifdef BITSTREAM_READER_LE