20 #ifndef KERNEL_UTILITIES_BLOOMFILTER_H 21 #define KERNEL_UTILITIES_BLOOMFILTER_H 23 #include "pedigree/kernel/processor/types.h" 24 #include "pedigree/kernel/utilities/ExtensibleBitmap.h" 25 #include "pedigree/kernel/utilities/smhasher/MurmurHash3.h" 32 : m_Bitmap(), m_nLength(length), m_nHashCount(hashcount)
37 void add(
const T &data)
39 add(&data,
sizeof(T));
42 void add(
const T *data,
size_t length)
45 MurmurHash3_x64_128(data, length, 0, baseHash);
47 for (
size_t i = 0; i < m_nHashCount; ++i)
49 uint64_t n = (baseHash[0] + (i * baseHash[1])) % m_nLength;
54 bool contains(
const T &data)
56 return contains(&data,
sizeof(T));
59 bool contains(
const T *data,
size_t length)
62 MurmurHash3_x64_128(data, length, 0, baseHash);
64 for (
size_t i = 0; i < m_nHashCount; ++i)
66 uint64_t n = (baseHash[0] + (i * baseHash[1])) % m_nLength;
67 if (!m_Bitmap.
test(n))
78 for (
size_t i = 0; i < m_nLength; ++i)
bool test(size_t n) const