Merge pull request #112 from mnaamani/hotfix-bloom-fromrate

bloom: fix minimum value of n
This commit is contained in:
Christopher Jeffrey (JJ) 2017-01-03 14:37:54 -08:00 committed by GitHub
commit f04206e671

View File

@ -166,7 +166,7 @@ Bloom.fromRate = function fromRate(items, rate, update) {
if (update !== -1)
size = Math.min(size, constants.bloom.MAX_BLOOM_FILTER_SIZE * 8);
n = (size / items * LN2) | 0;
n = ((size / items * LN2) | 0) || 1;
if (update !== -1)
n = Math.min(n, constants.bloom.MAX_HASH_FUNCS);