diff --git a/bloomfilter.js b/bloomfilter.js index e3d1bae..ad7481b 100644 --- a/bloomfilter.js +++ b/bloomfilter.js @@ -11,7 +11,7 @@ this.k = k; var n = Math.ceil(m / 32); if (typedArrays) { - var buffer = new ArrayBuffer(32 * n), + var buffer = new ArrayBuffer(4 * n), kbytes = 1 << Math.ceil(Math.log(Math.ceil(Math.log(m) / Math.LN2 / 8)) / Math.LN2), array = kbytes === 1 ? Uint8Array : kbytes === 2 ? Uint16Array : Uint32Array, kbuffer = new ArrayBuffer(kbytes * k);