From 67fd21959334af7ea0594b779f676e5e88b48a19 Mon Sep 17 00:00:00 2001 From: Moritz Hanke Date: Tue, 9 Sep 2014 17:10:59 +0200 Subject: [PATCH] replace "<" in FLUSH with "&" --- src/decode.c | 13 +++++++------ 1 file 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); \ -- 2.7.4