diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-09-30 04:39:55 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-09-30 17:20:40 +0400 |
commit | f51c4bfe3f34c8ff33a2b9d93e42745119c396a3 (patch) | |
tree | 8e5cd1c54de06e85abe96386e490d9eb669c8323 /libavcodec | |
parent | 89a823ace9dbbb47cbea9b11756295c76fdc366e (diff) |
bitstream: add get_bits_longlong() to support more than 32bits
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/get_bits.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h index 0aabca23cc..05ac8f7ef9 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -316,6 +316,24 @@ static inline unsigned int get_bits_long(GetBitContext *s, int n) } /** + * Read 0-64 bits. + */ +static inline uint64_t get_bits_longlong(GetBitContext *s, int n) +{ + if (n <= 32) + return get_bits_long(s, n); + else { +#ifdef BITSTREAM_READER_LE + uint64_t ret = get_bits_long(s, 32); + return ret | (((uint64_t)get_bits_long(s, n-32)) << 32); +#else + uint64_t ret = ((uint64_t)get_bits_long(s, 32)) << (n-32); + return ret | get_bits_long(s, n-32); +#endif + } +} + +/** * Read 0-32 bits as a signed integer. */ static inline int get_sbits_long(GetBitContext *s, int n) |