changeset 69:530168fc253f

Merge a memset with an existing loop, tweak comments.
author Rob Landley <rob@landley.net>
date Sat, 20 Jan 2007 12:30:19 -0500
parents 7b89650905c0
children a1b464bbef08
files lib/bunzip.c
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lib/bunzip.c	Fri Jan 19 16:31:11 2007 -0500
+++ b/lib/bunzip.c	Sat Jan 20 12:30:19 2007 -0500
@@ -264,8 +264,10 @@
 	// 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 @@
 		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.