From 125a2c74f2ef9438b09930b208dd88bf7538bac8 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 20 Jan 2007 12:30:19 -0500 Subject: Merge a memset with an existing loop, tweak comments. --- lib/bunzip.c | 17 +++++++++++------ 1 file 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. -- cgit v1.2.3