Commit f51c4bfe authored by Michael Niedermayer's avatar Michael Niedermayer

bitstream: add get_bits_longlong() to support more than 32bits

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 89a823ac
...@@ -315,6 +315,24 @@ static inline unsigned int get_bits_long(GetBitContext *s, int n) ...@@ -315,6 +315,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. * Read 0-32 bits as a signed integer.
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment