-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbloom.h
More file actions
31 lines (23 loc) · 758 Bytes
/
Copy pathbloom.h
File metadata and controls
31 lines (23 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef _BLOOM_H_
#define _BLOOM_H_
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
#include <stddef.h>
#include <limits.h>
#include "murmur3.h"
/* Size of the Bloom filter */
#define _BF_SIZE 4096
/* Number of hashes used to add/query elements in the filter */
#define _BF_HASH_NUMBER 12
typedef struct {
uint64_t data[_BF_SIZE];
} BloomFilter;
/* Create a new, empty Bloom filter */
BloomFilter BloomFilter_create();
/* Add `key` of length `len` into the Bloom filter `bf` */
void BloomFilter_add(BloomFilter * bf, const void * key, int len);
/* Query if `key` of length `len` is in the Bloom filter `bf` */
/* Returns 0 is false, 1 if true */
int BloomFilter_query(BloomFilter * bf, const void * key, int len);
#endif // _BLOOM_H_