bloomfilter
Advanced tools
Comparing version 0.0.14 to 0.0.15
@@ -37,3 +37,3 @@ (function(exports) { | ||
// See http://willwhim.wordpress.com/2011/09/03/producing-n-hash-functions-by-hashing-only-once/ | ||
// See http://willwhim.wpengine.com/2011/09/03/producing-n-hash-functions-by-hashing-only-once/ | ||
BloomFilter.prototype.locations = function(v) { | ||
@@ -94,18 +94,7 @@ var k = this.k, | ||
function fnv_1a(v) { | ||
var n = v.length, | ||
a = 2166136261, | ||
c, | ||
d, | ||
i = -1; | ||
while (++i < n) { | ||
c = v.charCodeAt(i); | ||
if (d = c & 0xff000000) { | ||
a ^= d >> 24; | ||
a += (a << 1) + (a << 4) + (a << 7) + (a << 8) + (a << 24); | ||
} | ||
if (d = c & 0xff0000) { | ||
a ^= d >> 16; | ||
a += (a << 1) + (a << 4) + (a << 7) + (a << 8) + (a << 24); | ||
} | ||
if (d = c & 0xff00) { | ||
var a = 2166136261; | ||
for (var i = 0, n = v.length; i < n; ++i) { | ||
var c = v.charCodeAt(i), | ||
d = c & 0xff00; | ||
if (d) { | ||
a ^= d >> 8; | ||
@@ -115,11 +104,6 @@ a += (a << 1) + (a << 4) + (a << 7) + (a << 8) + (a << 24); | ||
a ^= c & 0xff; | ||
// a = a * 16777619 mod 2**32 | ||
a += (a << 1) + (a << 4) + (a << 7) + (a << 8) + (a << 24); | ||
} | ||
// From http://home.comcast.net/~bretm/hash/6.html | ||
a += a << 13; | ||
a ^= a >> 7; | ||
a += a << 3; | ||
a ^= a >> 17; | ||
a += a << 5; | ||
return a & 0xffffffff; | ||
return fnv_mix(a); | ||
} | ||
@@ -129,3 +113,7 @@ | ||
function fnv_1a_b(a) { | ||
a += (a << 1) + (a << 4) + (a << 7) + (a << 8) + (a << 24); | ||
return fnv_mix(a + (a << 1) + (a << 4) + (a << 7) + (a << 8) + (a << 24)); | ||
} | ||
// See https://web.archive.org/web/20131019013225/http://home.comcast.net/~bretm/hash/6.html | ||
function fnv_mix(a) { | ||
a += a << 13; | ||
@@ -132,0 +120,0 @@ a ^= a >> 7; |
{ | ||
"name": "bloomfilter", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "Fast bloom filter in JavaScript.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8595
6
153