57 static unsigned const c_powerOfTwoBitMmask[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
69 BOOST_THROW_EXCEPTION(Overflow());
83 (*this)[i / 8] &= ~c_powerOfTwoBitMmask[i % 8];
90 unsigned iByte = _index / 8;
91 unsigned iBit = _index % 8;
92 return (_h[iByte] & c_powerOfTwoBitMmask[iBit]) != 0;
98 unsigned iByte = _index / 8;
99 unsigned iBit = _index % 8;
100 _h[iByte] |= c_powerOfTwoBitMmask[iBit];
103 template <
unsigned N>
109 static_assert(4 ==
AbridgedTopic::size,
"wrong template parameter in TopicBloomFilterBase<N>::bloom()");
110 static_assert(3 == BitsPerBloom,
"wrong template parameter in TopicBloomFilterBase<N>::bloom()");
114 if (TopicBloomFilterSize == N)
115 for (
unsigned i = 0; i < BitsPerBloom; ++i)
118 if (_h[BitsPerBloom] & c_powerOfTwoBitMmask[i])
124 for (
unsigned i = 0; i < BitsPerBloom; ++i)
126 unsigned x = unsigned(_h[i]) + unsigned(_h[i + 1]);
std::array< uint16_t, CounterSize > m_refCounter
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
void removeRaw(FixedHash< N > const &_h)
bool contains(FixedHash const &_c) const
static const unsigned CounterSize
bool containsRaw(FixedHash< N > const &_h) const
TopicBloomFilterBase(FixedHash< N > const &_h)
static bool isBitSet(FixedHash< N > const &_h, unsigned _index)
Fixed-size raw-byte array container type, with an API optimised for storing hashes.
void removeBloom(AbridgedTopic const &_h)
void addBloom(AbridgedTopic const &_h)
void addRaw(FixedHash< N > const &_h)
static FixedHash< N > bloom(AbridgedTopic const &_h)
bool containsBloom(AbridgedTopic const &_h) const
static void setBit(FixedHash< N > &_h, unsigned index)