/js-crc32

:cyclone: JS standard CRC-32 implementation

Primary LanguagePythonApache License 2.0Apache-2.0

修正会出现负数的bug

JavaScript采用IEEE 754标准定义的64位浮点格式表示数字,因此它的数字都是有符号的。在运算过程中虽然都使用了>>>(Zero-fill right shift),但是在最后返回结果的时候没有将有符号数转化为无符号数,因此出现了负数的情况。

解决方法很简单,把上述源码里的:

return C ^ -1;

全部替换为

return (C ^ (-1)) >>> 0;

crc32

参见SheetJS/js-crc32

Badges

Sauce Test Status

Build Status Coverage Status Dependencies Status NPM Downloads ghit.me Analytics