changeset 9098:66f1dba43a01 libavcodec

Add a get_sbits_long() function.
author jbr
date Tue, 03 Mar 2009 02:00:47 +0000
parents b2f29d9da737
children 152bee4c0722
files bitstream.h
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/bitstream.h	Tue Mar 03 01:53:54 2009 +0000
+++ b/bitstream.h	Tue Mar 03 02:00:47 2009 +0000
@@ -33,6 +33,7 @@
 #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
@@ -707,6 +708,13 @@
 }
 
 /**
+ * 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.
  */
 static inline unsigned int show_bits_long(GetBitContext *s, int n){