Mercurial > hg > toybox
changeset 59:e82ae73acbd7
Another application of Manuel Nova's "math instead of ifs" trick. Saves 17b.
author | Rob Landley <rob@landley.net> |
---|---|
date | Wed, 17 Jan 2007 16:58:51 -0500 |
parents | b060142aee01 |
children | 23aac9d42234 |
files | lib/bunzip.c |
diffstat | 1 files changed, 1 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/bunzip.c Wed Jan 17 16:56:28 2007 -0500 +++ b/lib/bunzip.c Wed Jan 17 16:58:51 2007 -0500 @@ -316,8 +316,7 @@ 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; }