From: Moritz Hanke Date: Tue, 9 Sep 2014 15:36:14 +0000 (+0200) Subject: removes on loop in FLUSH X-Git-Tag: accepted/tizen/5.0/unified/20181102.025501~47 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b519321aa915b8023a6cc3479ace64613faf0810;p=platform%2Fupstream%2Flibaec.git removes on loop in FLUSH --- 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); \ } \