summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Hanke <hanke@dkrz.de>2014-09-09 16:56:05 +0200
committerMathis Rosenhauer <rosenhauer@dkrz.de>2014-10-24 16:08:27 +0200
commite601c7d8712fca7a3b6e1b8e89ea2b7b0bd08a26 (patch)
tree509e3d9193d429d95fdf92a896f5808e0f6eb805
parent9af97721e78da0c2e5be2f82ee8ca9d0fb951ddc (diff)
downloadlibaec-e601c7d8712fca7a3b6e1b8e89ea2b7b0bd08a26.tar.gz
libaec-e601c7d8712fca7a3b6e1b8e89ea2b7b0bd08a26.tar.bz2
libaec-e601c7d8712fca7a3b6e1b8e89ea2b7b0bd08a26.zip
replaces subtraction with XOR in FLUSH
-rw-r--r--src/decode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/decode.c b/src/decode.c
index a8c0afc..22487fd 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -105,10 +105,11 @@
data = d; \
} \
} else { \
- if (half_d <= xmax - data) { \
+ /*in this case (xmax - data == xmax ^ data)*/ \
+ if (half_d <= (xmax ^ data)) { \
data += (d >> 1)^(~((d & 1) - 1)); \
} else { \
- data = xmax - d; \
+ data = xmax ^ d; \
} \
} \
put_##KIND(strm, (uint32_t)data); \