bloom: fix minimum value of n

This commit is contained in:
Mokhtar Naamani 2017-01-03 17:37:15 +02:00
parent f8fa536129
commit f5a00c6e6b

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);