diff options
-rw-r--r-- | src/decode.c | 5 |
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); \ |