From 25164464d6a484d698f8ebc443ae78d658db945d Mon Sep 17 00:00:00 2001 From: vvmint Date: Wed, 4 May 2022 19:44:43 +0800 Subject: [PATCH] Fix problem in shift x >> 15 may be less than 0 but x should an Uint32 number and x >>> 15 is also an Uint32 number --- lib/checksum.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/checksum.js b/lib/checksum.js index b634d4f..bd19b20 100644 --- a/lib/checksum.js +++ b/lib/checksum.js @@ -5,7 +5,7 @@ module.exports = function (value) { var x = crc32c(value) var result = bufferAlloc(4) - result.writeUInt32LE(((((x >> 15) | (x << 17)) + 0xa282ead8)) >>> 0, 0, true) + result.writeUInt32LE(((((x >>> 15) | (x << 17)) + 0xa282ead8)) >>> 0, 0, true) return result - } \ No newline at end of file + }