aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans-Nikolai Viessmann2019-02-02 13:18:22 +0000
committerHans-Nikolai Viessmann2019-02-02 13:18:22 +0000
commit9fc00fc997d9101c9a490c199180228367d54af0 (patch)
tree2abce834f139fac4bc8c8843e5fcf94c8ea3509d
parente517f35de51f94011f4029842832d3f4d2c1d053 (diff)
downloadpractice-master.tar.gz
practice-master.zip
fixed bloomfilter hashHEADmaster
Forgot to pass the CPP value for the bitsize of the bit-array.
-rw-r--r--bloom_filter/bloom.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bloom_filter/bloom.c b/bloom_filter/bloom.c
index ef5c4af..fac6aa9 100644
--- a/bloom_filter/bloom.c
+++ b/bloom_filter/bloom.c
@@ -6,7 +6,7 @@
#define B 14 /* power of */
#define M 16384 /* number of bits */
-#define K 8 /* number of hash varients */
+#define K 8 /* number of hash varients */
static void
print_barray (ub1 * barray)
@@ -31,7 +31,7 @@ bloom_add_check (ub1 * barray, ub1 * key, ub4 len, bool check)
for (i = 0, h = 0; i < K; i++)
{
- h = (hash (key, len, h) & hashmask(10));
+ h = (hash (key, len, h) & hashmask(B));
// printf ("Hashing `%s`, return is: %lu\n", key, h);
if (check)
{