#ifndef BOOST_BLOOM_BLOCK_HPP
#define BOOST_BLOOM_BLOCK_HPP
#include <boost/bloom/detail/block_base.hpp>
#include <boost/bloom/detail/block_ops.hpp>
#include <boost/bloom/detail/block_fpr_base.hpp>
#include <cstddef>
#include <cstdint>
namespace boost{
namespace bloom{
template<typename Block,std::size_t K>
struct block:
public detail::block_fpr_base<K>,
private detail::block_base<Block,K>
{
static constexpr std::size_t k=K;
using value_type=Block;
static inline void mark(value_type& x,std::uint64_t hash)
{
loop(hash,[&](std::uint64_t h){block_ops::set(x,h&mask);});
}
static inline bool check(const value_type& x,std::uint64_t hash)
{
return check(x,hash,typename block_ops::is_extended_block{});
}
private:
using super=detail::block_base<Block,K>;
using super::mask;
using super::loop;
using super::loop_while;
using block_ops=detail::block_ops<Block>;
static inline bool check(
const value_type& x,std::uint64_t hash,
std::false_type )
{
Block fp;
block_ops::zero(fp);
mark(fp,hash);
return block_ops::testc(x,fp);
}
static inline bool check(
const value_type& x,std::uint64_t hash,
std::true_type )
{
return loop_while(hash,[&](std::uint64_t h){
return block_ops::get_at_lsb(x,h&mask)&1;
});
}
};
}
}
#endif