summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Hanke <hanke@dkrz.de>2014-09-09 15:10:59 (GMT)
committerMathis Rosenhauer <rosenhauer@dkrz.de>2014-10-24 14:08:27 (GMT)
commit67fd21959334af7ea0594b779f676e5e88b48a19 (patch)
tree65ea5f156dd5afb07b3933fd8689671c118951b6
parente601c7d8712fca7a3b6e1b8e89ea2b7b0bd08a26 (diff)
downloadlibaec-67fd21959334af7ea0594b779f676e5e88b48a19.zip
libaec-67fd21959334af7ea0594b779f676e5e88b48a19.tar.gz
libaec-67fd21959334af7ea0594b779f676e5e88b48a19.tar.bz2
replace "<" in FLUSH with "&"
-rw-r--r--src/decode.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/decode.c b/src/decode.c
index 22487fd..3a25e6e 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -98,18 +98,19 @@
d = *bp; \
half_d = (d >> 1) + (d & 1); \
\
- if (data < med) { \
- if (half_d <= data) { \
+ /*in this case: data >= med == data & med */ \
+ if (data & med) { \
+ /*in this case: xmax - data == xmax ^ data */ \
+ if (half_d <= (xmax ^ data)) { \
data += (d >> 1)^(~((d & 1) - 1)); \
} else { \
- data = d; \
+ data = xmax ^ d; \
} \
} else { \
- /*in this case (xmax - data == xmax ^ data)*/ \
- if (half_d <= (xmax ^ data)) { \
+ if (half_d <= data) { \
data += (d >> 1)^(~((d & 1) - 1)); \
} else { \
- data = xmax ^ d; \
+ data = d; \
} \
} \
put_##KIND(strm, (uint32_t)data); \