string-hash
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -9,5 +9,5 @@ module.exports = function(str) { | ||
/* JavaScript does bitwise operations (like XOR, above) on 32-bit signed | ||
* integers. Since we want the results to be always positive, if the high bit | ||
* is set, unset it and add it back in through (64-bit IEEE) addition. */ | ||
return hash >= 0 ? hash : (hash & 0x7FFFFFFF) + 0x80000000 | ||
* integers. Since we want the results to be always positive, convert the | ||
* signed int to an unsigned by doing an unsigned bitshift. */ | ||
return hash >>> 0; | ||
} |
{ | ||
"name": "string-hash", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "fast string hashing function", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -12,1 +12,12 @@ string-hash | ||
The hashing function returns a number between 0 and 4294967295 (inclusive). | ||
Thanks to [cscott](https://github.com/cscott) for reminding us how integers | ||
work in JavaScript. | ||
License | ||
------- | ||
To the extend possible by law, The Dark Sky Company, LLC has [waived all | ||
copyright and related or neighboring rights][cc0] to this library. | ||
[cc0]: http://creativecommons.org/publicdomain/zero/1.0/ |
2366
6
39
23