murmurHash3js icon indicating copy to clipboard operation
murmurHash3js copied to clipboard

Fix negative integers

Open Llorx opened this issue 2 years ago • 0 comments

When you shift bits to the left, it is a signed operation (there's no unsigned left shift). If it ends being a 32 bit integer, if the leftmost bit is 1 it is going to convert to a negative number. You need to do an unsigned shift to the right with 0 displacement to keep the unsigned integer.

I only fixed the hash32 method as this one is the one I needed.

Llorx avatar Oct 03 '23 17:10 Llorx