summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Hanke <hanke@dkrz.de>2014-09-09 15:36:14 (GMT)
committerMathis Rosenhauer <rosenhauer@dkrz.de>2014-10-24 14:08:27 (GMT)
commitb519321aa915b8023a6cc3479ace64613faf0810 (patch)
tree14faee5433cfe7f642e4f91f0ad88edfb519277f
parent67fd21959334af7ea0594b779f676e5e88b48a19 (diff)
downloadlibaec-b519321aa915b8023a6cc3479ace64613faf0810.zip
libaec-b519321aa915b8023a6cc3479ace64613faf0810.tar.gz
libaec-b519321aa915b8023a6cc3479ace64613faf0810.tar.bz2
removes on loop in FLUSH
-rw-r--r--src/decode.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/decode.c b/src/decode.c
index 3a25e6e..f3b94e8 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -97,21 +97,14 @@
for (bp = state->flush_start; bp < flush_end; bp++) { \
d = *bp; \
half_d = (d >> 1) + (d & 1); \
- \
/*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 = xmax ^ d; \
- } \
+ uint32_t mask = (data & med)?xmax:0; \
+ \
+ /*in this case: xmax - data == xmax ^ data */ \
+ if (half_d <= (mask ^ data)) { \
+ data += (d >> 1)^(~((d & 1) - 1)); \
} else { \
- if (half_d <= data) { \
- data += (d >> 1)^(~((d & 1) - 1)); \
- } else { \
- data = d; \
- } \
+ data = mask ^ d; \
} \
put_##KIND(strm, (uint32_t)data); \
} \