From f83a02d145c5acbc0e74de79af25e1090fc2183a Mon Sep 17 00:00:00 2001 From: Jason Davies Date: Thu, 6 Sep 2012 09:19:22 +0100 Subject: [PATCH] Simplify. --- bloomfilter.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bloomfilter.js b/bloomfilter.js index ad7481b..c69cdf0 100644 --- a/bloomfilter.js +++ b/bloomfilter.js @@ -11,11 +11,10 @@ this.k = k; var n = Math.ceil(m / 32); if (typedArrays) { - var buffer = new ArrayBuffer(4 * n), - kbytes = 1 << Math.ceil(Math.log(Math.ceil(Math.log(m) / Math.LN2 / 8)) / Math.LN2), + var 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); - this.buckets = new Uint32Array(buffer); + this.buckets = new Int32Array(n); this._locations = new array(kbuffer); } else { var buckets = this.buckets = [],