equal
deleted
inserted
replaced
110 timing throughput: |
110 timing throughput: |
111 [exBegin] |
111 [exBegin] |
112 |hashStream n t| |
112 |hashStream n t| |
113 |
113 |
114 hashStream := CRC32Stream new. |
114 hashStream := CRC32Stream new. |
115 n := 100000. |
115 n := 1000000. |
116 t := Time millisecondsToRun:[ |
116 t := Time millisecondsToRun:[ |
117 n timesRepeat:[ |
117 n timesRepeat:[ |
118 hashStream nextPutAll:'12345678901234567890123456789012345678901234567890'. |
118 hashStream nextPutAll:'12345678901234567890123456789012345678901234567890'. |
119 ]. |
119 ]. |
120 ]. |
120 ]. |
298 } |
298 } |
299 |
299 |
300 _crcTable = __integerArrayVal( __INST(crcTable) ); |
300 _crcTable = __integerArrayVal( __INST(crcTable) ); |
301 |
301 |
302 #ifdef __LSBFIRST__ |
302 #ifdef __LSBFIRST__ |
303 if (((unsigned)cp & 3) == 0) { |
303 if (((unsigned INT)cp & 3) == 0) { |
304 // word aligned |
304 // word aligned |
305 while (n >= 4) { |
305 while (n >= 4) { |
306 unsigned word; |
306 unsigned word; |
307 unsigned _idx; |
307 unsigned _idx; |
308 |
308 |
340 |
340 |
341 _idx = (_crc ^ _byte) & 0xFF; |
341 _idx = (_crc ^ _byte) & 0xFF; |
342 _crc = _crcTable[_idx] ^ (_crc >> 8); |
342 _crc = _crcTable[_idx] ^ (_crc >> 8); |
343 n--; |
343 n--; |
344 } |
344 } |
345 __INST(crc) = __MKUINT(_crc); |
345 #if POINTER_SIZE == 8 |
|
346 __INST(crc) = __MKSMALLINT(_crc); |
|
347 #else |
|
348 { |
|
349 OBJ t; |
|
350 __INST(crc) = t = __MKUINT(_crc); __STORE(self, t); |
|
351 } |
|
352 #endif |
346 } |
353 } |
347 RETURN (count); |
354 RETURN (count); |
348 } |
355 } |
349 } |
356 } |
350 bad: ; |
357 bad: ; |
355 ! ! |
362 ! ! |
356 |
363 |
357 !CRC32Stream class methodsFor:'documentation'! |
364 !CRC32Stream class methodsFor:'documentation'! |
358 |
365 |
359 version |
366 version |
360 ^ '$Header: /cvs/stx/stx/libbasic2/CRC32Stream.st,v 1.24 2013-02-20 15:39:59 cg Exp $' |
367 ^ '$Header: /cvs/stx/stx/libbasic2/CRC32Stream.st,v 1.25 2013-04-02 08:59:01 cg Exp $' |
361 ! |
368 ! |
362 |
369 |
363 version_CVS |
370 version_CVS |
364 ^ '$Header: /cvs/stx/stx/libbasic2/CRC32Stream.st,v 1.24 2013-02-20 15:39:59 cg Exp $' |
371 ^ '$Header: /cvs/stx/stx/libbasic2/CRC32Stream.st,v 1.25 2013-04-02 08:59:01 cg Exp $' |
365 ! ! |
372 ! ! |
366 |
373 |
367 |
374 |
368 CRC32Stream initialize! |
375 CRC32Stream initialize! |