diff options
author | Moritz Hanke <hanke@dkrz.de> | 2014-09-09 17:36:14 +0200 |
---|---|---|
committer | Mathis Rosenhauer <rosenhauer@dkrz.de> | 2014-10-24 16:08:27 +0200 |
commit | b519321aa915b8023a6cc3479ace64613faf0810 (patch) | |
tree | 14faee5433cfe7f642e4f91f0ad88edfb519277f | |
parent | 67fd21959334af7ea0594b779f676e5e88b48a19 (diff) | |
download | libaec-b519321aa915b8023a6cc3479ace64613faf0810.tar.gz libaec-b519321aa915b8023a6cc3479ace64613faf0810.tar.bz2 libaec-b519321aa915b8023a6cc3479ace64613faf0810.zip |
removes on loop in FLUSH
-rw-r--r-- | src/decode.c | 19 |
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); \ } \ |