# HG changeset patch # User michael # Date 1143837622 0 # Node ID b9a0ca749833750e035d13d31ada5ce67cf7fe0c # Parent 498543867d57db9e93e7beff7e904b8a41a1ea7a get_xbits() optimization diff -r 498543867d57 -r b9a0ca749833 bitstream.h --- a/bitstream.h Fri Mar 31 18:22:35 2006 +0000 +++ b/bitstream.h Fri Mar 31 20:40:22 2006 +0000 @@ -574,21 +574,15 @@ * @author BERO */ static inline int get_xbits(GetBitContext *s, int n){ - register int tmp; + register int sign; register int32_t cache; OPEN_READER(re, s) UPDATE_CACHE(re, s) cache = GET_CACHE(re,s); - if ((int32_t)cache<0) { //MSB=1 - tmp = NEG_USR32(cache,n); - } else { - // tmp = (-1<>31; LAST_SKIP_BITS(re, s, n) CLOSE_READER(re, s) - return tmp; + return (NEG_USR32(sign ^ cache, n) ^ sign) - sign; } static inline int get_sbits(GetBitContext *s, int n){