CRC32Stream.st
changeset 2307 213162f0a57e
parent 2306 75d9592b9d8a
child 2310 c6f63285e4c8
--- a/CRC32Stream.st	Sat Oct 10 23:46:52 2009 +0200
+++ b/CRC32Stream.st	Sun Oct 11 00:10:50 2009 +0200
@@ -20,7 +20,7 @@
     Use SHA1Stream or MD5Stream instead.
 
     throughput:
-        103890 Kb/s on 2Ghz Duo
+        150000 Kb/s on 2Ghz Duo
 
     [author:]
         Stefan Vogel (stefan@zwerg)
@@ -200,6 +200,20 @@
 
             _crcTable = __integerArrayVal( @global(CrcTable) );
 
+            while (n > 3) {
+                unsigned _idx;
+
+                _idx = (_crc ^ cp[0]) & 0xFF;
+                _crc = _crcTable[_idx] ^ (_crc >> 8);
+                _idx = (_crc ^ cp[1]) & 0xFF;
+                _crc = _crcTable[_idx] ^ (_crc >> 8);
+                _idx = (_crc ^ cp[2]) & 0xFF;
+                _crc = _crcTable[_idx] ^ (_crc >> 8);
+                _idx = (_crc ^ cp[3]) & 0xFF;
+                _crc = _crcTable[_idx] ^ (_crc >> 8);
+                cp += 4;
+                n -= 4;
+            }
             while (n > 0) {
                 unsigned _byte = *cp++;
                 unsigned _idx;
@@ -275,11 +289,11 @@
 !CRC32Stream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/CRC32Stream.st,v 1.6 2009-10-10 21:46:52 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/CRC32Stream.st,v 1.7 2009-10-10 22:10:50 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/CRC32Stream.st,v 1.6 2009-10-10 21:46:52 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/CRC32Stream.st,v 1.7 2009-10-10 22:10:50 cg Exp $'
 ! !
 
 CRC32Stream initialize!