diff options
author | Rob Landley <rob@landley.net> | 2007-01-17 16:58:51 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2007-01-17 16:58:51 -0500 |
commit | 6c8eaae1387f9739e56456c9574ec5435d240fe6 (patch) | |
tree | 4349d4f1e7302445dd6fd40eaa15f9d63e494c32 | |
parent | 8aa0e949975773e1e944fa36d6e75e3c04fa12e1 (diff) | |
download | toybox-6c8eaae1387f9739e56456c9574ec5435d240fe6.tar.gz |
Another application of Manuel Nova's "math instead of ifs" trick. Saves 17b.
-rw-r--r-- | lib/bunzip.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/bunzip.c b/lib/bunzip.c index 74e7b172..9a0ec6d8 100644 --- a/lib/bunzip.c +++ b/lib/bunzip.c @@ -316,8 +316,7 @@ int read_bunzip_data(bunzip_data *bd) the basic or 0/1 method (except all bits 0, which would use no symbols, but a run of length 0 doesn't mean anything in this context). Thus space is saved. */ - if (nextSym == SYMBOL_RUNA) t += runPos; - else t += 2*runPos; + t += (runPos << nextSym); // +runPos if RUNA; +2*runPos if RUNB runPos <<= 1; continue; } |