aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma
diff options
context:
space:
mode:
Diffstat (limited to 'src/liblzma')
-rw-r--r--src/liblzma/rangecoder/range_decoder.h53
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)
///////////////////////