diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2008-03-24 16:38:40 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2008-03-24 16:38:40 +0200 |
commit | 641998c3e1ecc8b598fe0eb051fab8b9535c291b (patch) | |
tree | 7a0cee9b393131475cca96848d0f72fc62153460 /src | |
parent | Take advantage of arithmetic right shift in range decoder. (diff) | |
download | xz-641998c3e1ecc8b598fe0eb051fab8b9535c291b.tar.xz |
Replaced the range decoder optimization that used arithmetic
right shift with as fast version that doesn't need
arithmetic right shift. Removed the related check from
configure.ac.
Diffstat (limited to 'src')
-rw-r--r-- | src/liblzma/rangecoder/range_decoder.h | 53 |
1 files changed, 16 insertions, 37 deletions
diff --git a/src/liblzma/rangecoder/range_decoder.h b/src/liblzma/rangecoder/range_decoder.h index a6a92b0b..62162448 100644 --- a/src/liblzma/rangecoder/range_decoder.h +++ b/src/liblzma/rangecoder/range_decoder.h @@ -121,26 +121,15 @@ do { \ } while (0) -#ifdef HAVE_ARITHMETIC_RSHIFT -# define rc_decode_direct(dest, count) \ - do { \ - rc_normalize(); \ - rc.range >>= 1; \ - rc.code -= rc.range; \ - rc_bound = (uint32_t)((int32_t)(rc.code) >> 31); \ - dest = (dest << 1) + (rc_bound + 1); \ - rc.code += rc.range & rc_bound; \ - } while (--count > 0) -#else -# define rc_decode_direct(dest, count) \ - do { \ - rc_normalize(); \ - rc.range >>= 1; \ - rc_bound = (rc.code - rc.range) >> 31; \ - rc.code -= rc.range & (rc_bound - 1); \ - dest = ((dest) << 1) | (1 - rc_bound);\ - } while (--count > 0) -#endif +#define rc_decode_direct(dest, count) \ +do { \ + rc_normalize(); \ + rc.range >>= 1; \ + rc.code -= rc.range; \ + rc_bound = UINT32_C(0) - (rc.code >> 31); \ + rc.code += rc.range & rc_bound; \ + dest = (dest << 1) + (rc_bound + 1); \ +} while (--count > 0) // Dummy versions don't update prob or dest. @@ -155,23 +144,13 @@ do { \ } while (0) -#ifdef HAVE_ARITHMETIC_RSHIFT -# define rc_decode_direct_dummy(count) \ - do { \ - rc_normalize(); \ - rc.range >>= 1; \ - rc.code -= rc.range; \ - rc.code += rc.range & ((uint32_t)((int32_t)(rc.code) >> 31)); \ - } while (--count > 0) -#else -# define rc_decode_direct_dummy(count) \ - do { \ - rc_normalize(); \ - rc.range >>= 1; \ - rc_bound = (rc.code - rc.range) >> 31; \ - rc.code -= rc.range & (rc_bound - 1); \ - } while (--count > 0) -#endif +#define rc_decode_direct_dummy(count) \ +do { \ + rc_normalize(); \ + rc.range >>= 1; \ + rc.code -= rc.range; \ + rc.code += rc.range & (UINT32_C(0) - (rc.code >> 31)); \ +} while (--count > 0) /////////////////////// |