27 size_t mem_size_bits_;
28 hash_functions_t hash_functions_;
29 std::unordered_map<hash_t, uint8_t> count_per_checksum;
32 static const size_t BITS_PER_ELEMENT =
sizeof(uint64_t) * CHAR_BIT;
35 size_t get_index(
size_t bit)
const;
36 size_t get_mask(
size_t bit)
const;
38 bool test(
size_t bit)
const;
41 BloomFilter(
size_t mem_size, hash_functions_t hash_functions)
45 mem_size_bits_(mem_size * BITS_PER_ELEMENT)
46 , hash_functions_(hash_functions)
49 bits_ =
new uint64_t[mem_size_]{ 0 };
50 if (hash_functions.empty())
51 throw std::invalid_argument(
"Bloom filter has no hash functions");
66 void insert(
const int* clause,
unsigned int size);
67 uint8_t test_and_insert(
const int* clause,
unsigned int size);
68 uint8_t test_and_insert(
size_t checksum,
int max_limit_duplicas);
69 bool contains_or_insert(
const int* clause,
unsigned int size);
70 bool contains(
const int* clause,
unsigned int size);
size_t lookup3_hash_clause(const int *clause, unsigned int size)
Computes a hash value for a clause using the Jenkins lookup3 algorithm.
Definition ClauseUtils.hpp:55