diff options
author | Rob Landley <rob@landley.net> | 2007-01-20 12:30:19 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2007-01-20 12:30:19 -0500 |
commit | 125a2c74f2ef9438b09930b208dd88bf7538bac8 (patch) | |
tree | d1a15791bdc4b58666be51ce0ac6698d00cdd412 /lib | |
parent | 94515a2803d8db4b5a0c1cc51554f79a98803891 (diff) | |
download | toybox-125a2c74f2ef9438b09930b208dd88bf7538bac8.tar.gz |
Merge a memset with an existing loop, tweak comments.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bunzip.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/bunzip.c b/lib/bunzip.c index 139848e7..049dc02e 100644 --- a/lib/bunzip.c +++ b/lib/bunzip.c @@ -264,8 +264,10 @@ int read_bunzip_data(bunzip_data *bd) // and run length encoding, saving the result into dbuf[dbufCount++] = uc // Initialize symbol occurrence counters and symbol mtf table - memset(byteCount, 0, 256*sizeof(int)); - for(i=0; i<256; i++) mtfSymbol[i] = (unsigned char)i; + for(i=0; i<256; i++) { + byteCount[i] = 0; + mtfSymbol[i] = i; + } // Loop through compressed symbols. This is the first "tight inner loop" // that needs to be micro-optimized for speed. (This one fills out dbuf[] @@ -360,10 +362,13 @@ int read_bunzip_data(bunzip_data *bd) dbuf[dbufCount++] = (unsigned int)uc; } - /* At this point, we've finished reading huffman-coded symbols and - compressed runs from the input stream. There are dbufCount many of - them in dbuf[]. Now undo the Burrows-Wheeler transform on dbuf. - See http://marknelson.us/1996/09/01/bwt/ + /* At this point, we've finished reading all of this block's huffman-coded + * symbols (and repeated runs) from the input stream, and have written + * dbufCount many of them into dbuf[], the intermediate buffer. + * + * Now undo the Burrows-Wheeler transform on dbuf, described here: + * http://dogma.net/markn/articles/bwt/bwt.htm + * http://marknelson.us/1996/09/01/bwt/ */ // Now we know what dbufCount is, do a better sanity check on origPtr. |