SheetJS
e1c9c5e5cd
- normalized crc iteration logic - added browser demo - added command line tool crc32 - fixed unicode baseline script (node 6 changed default array printing) - fixed performance tests (benchmark module changed behavior) - updated travis versions for test - miscellaneous adjustments to tooling
23 lines
754 B
JavaScript
23 lines
754 B
JavaScript
/* see perf/crc32table.js */
|
|
/*global Int32Array */
|
|
function signed_crc_table()/*:CRC32TableType*/ {
|
|
var c = 0, table/*:Array<number>*/ = 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 T = signed_crc_table();
|