42 assert(items.size() == 4);
45 m_filter_size = atoi(items[0].c_str());
46 m_num_hashes = atoi(items[1].c_str());
47 m_skip_bits = atoi(items[2].c_str());
49 if (items[3] ==
"Regular") {
51 }
else if (items[3] ==
"Parallel") {
54 panic(
"ERROR: Incorrect config string for MultiBitSel Bloom! :%s",
58 m_filter_size_bits =
floorLog2(m_filter_size);
60 m_par_filter_size = m_filter_size / m_num_hashes;
61 m_par_filter_size_bits =
floorLog2(m_par_filter_size);
63 m_filter.resize(m_filter_size);
74 for (
int i = 0;
i < m_filter_size;
i++) {
97 for (
int i = 0;
i < m_filter_size; ++
i){
98 m_filter[
i] |= (*temp)[
i];
105 for (
int i = 0;
i < m_num_hashes;
i++) {
106 int idx = get_index(addr,
i);
114 cout <<
"ERROR: Unset should never be called in a Bloom filter";
123 for (
int i=0;
i < m_num_hashes;
i++) {
124 int idx = get_index(addr,
i);
125 res = res && m_filter[idx];
133 return isSet(addr)? 1: 0;
158 for (
int i = 0;
i < m_filter_size;
i++) {
159 count += m_filter[
i];
176 int y = hash_bitsel(x, i, m_num_hashes, 30, m_filter_size_bits);
180 return (y % m_par_filter_size) + i*m_par_filter_size;
182 return y % m_filter_size;
188 int maxBits,
int numBits)
194 for (i = 0; i < numBits; i++) {
195 bit = (index + jump*
i) % maxBits;
196 if (value & (mask << bit)) result += mask << i;
void increment(Addr addr)
int hash_bitsel(uint64_t value, int index, int jump, int maxBits, int numBits)
void print(std::ostream &out) const
~MultiBitSelBloomFilter()
MultiBitSelBloomFilter(std::string config)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Addr makeLineAddress(Addr addr)
int floorLog2(unsigned x)
void tokenize(vector< string > &v, const string &s, char token, bool ignore)
void decrement(Addr addr)
void writeBit(const int index, const int value)
int get_index(Addr addr, int hashNumber)
void merge(AbstractBloomFilter *other_filter)
int readBit(const int index)