#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
+#include "mathops.h"
#if defined(ALT_BITSTREAM_READER_LE) && !defined(ALT_BITSTREAM_READER)
# define ALT_BITSTREAM_READER
/**
* Skips the given number of bits.
* Must only be used if the actual values in the bitstream do not matter.
+ * If \p n is 0 the behavior is undefined.
*/
static inline void skip_put_bits(PutBitContext *s, int n){
#ifdef ALT_BITSTREAM_WRITER
}
}
+/**
+ * reads 0-32 bits as a signed integer.
+ */
+static inline int get_sbits_long(GetBitContext *s, int n) {
+ return sign_extend(get_bits_long(s, n), n);
+}
+
/**
* shows 0-32 bits.
*/
if(n<=17) return show_bits(s, n);
else{
GetBitContext gb= *s;
- int ret= get_bits_long(s, n);
- *s= gb;
- return ret;
+ return get_bits_long(&gb, n);
}
}