-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbloom.h
More file actions
29 lines (24 loc) · 944 Bytes
/
Copy pathbloom.h
File metadata and controls
29 lines (24 loc) · 944 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
#ifndef BLOOM_FILTER_H
#define BLOOM_FILTER_H
#include <stdarg.h>
#include <stdbool.h>
#include <string.h>
#include <unitypes.h>
#include "bitarray/bitarray.h"
#include "hash/hash.h"
typedef struct BloomFilterCtx {
BitArray* array;
HashFunc* hash_functions;
size_t num_functions;
size_t num_items;
} BloomFilterCtx;
extern BloomFilterCtx* bloom_filter_new(size_t size, size_t num_functions, ...);
extern BloomFilterCtx* bloom_filter_new_default(size_t size);
extern void bloom_filter_free(BloomFilterCtx* filter);
extern void bloom_filter_put(BloomFilterCtx* filter, const void* data,
size_t length);
extern void bloom_filter_put_str(BloomFilterCtx* filter, const char* str);
extern bool bloom_filter_test(BloomFilterCtx* filter, const void* data,
size_t length);
extern bool bloom_filter_test_str(BloomFilterCtx* filter, const char* str);
#endif