SheetJS
c79a8fb6c9
- used Int32Array for storing CRC32 table when possible - buf/array impl 4-step unrolling - integration performance tests
22 lines
694 B
JavaScript
22 lines
694 B
JavaScript
/* see perf/crc32table.js */
|
|
function signed_crc_table() {
|
|
var c, table = new Array(256);
|
|
|
|
for(var n =0; n != 256; ++n){
|
|
c = n;
|
|
c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
|
|
c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
|
|
c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
|
|
c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
|
|
c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
|
|
c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
|
|
c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
|
|
c = ((c&1) ? (-306674912 ^ (c >>> 1)) : (c >>> 1));
|
|
table[n] = c;
|
|
}
|
|
|
|
return typeof Int32Array !== 'undefined' ? new Int32Array(table) : table;
|
|
}
|
|
|
|
var table = signed_crc_table();
|