File indexing completed on 2026-08-17 08:39:06
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_BLOOM_BLOCK_HPP
0010 #define BOOST_BLOOM_BLOCK_HPP
0011
0012 #include <boost/bloom/detail/block_base.hpp>
0013 #include <boost/bloom/detail/block_ops.hpp>
0014 #include <boost/bloom/detail/block_fpr_base.hpp>
0015 #include <cstddef>
0016 #include <cstdint>
0017
0018 namespace boost{
0019 namespace bloom{
0020
0021 template<typename Block,std::size_t K>
0022 struct block:
0023 public detail::block_fpr_base<K>,
0024 private detail::block_base<Block,K>
0025 {
0026 static constexpr std::size_t k=K;
0027 using value_type=Block;
0028
0029
0030 static inline void mark(value_type& x,std::uint64_t hash)
0031 {
0032 loop(hash,[&](std::uint64_t h){block_ops::set(x,h&mask);});
0033 }
0034
0035
0036 static inline bool check(const value_type& x,std::uint64_t hash)
0037 {
0038 return check(x,hash,typename block_ops::is_extended_block{});
0039 }
0040
0041 private:
0042 using super=detail::block_base<Block,K>;
0043 using super::mask;
0044 using super::loop;
0045 using super::loop_while;
0046 using block_ops=detail::block_ops<Block>;
0047
0048
0049 static inline bool check(
0050 const value_type& x,std::uint64_t hash,
0051 std::false_type )
0052 {
0053 Block fp;
0054 block_ops::zero(fp);
0055 mark(fp,hash);
0056 return block_ops::testc(x,fp);
0057 }
0058
0059
0060 static inline bool check(
0061 const value_type& x,std::uint64_t hash,
0062 std::true_type )
0063 {
0064 int res=1;
0065 loop(hash,[&](std::uint64_t h){
0066 res&=block_ops::get_at_lsb(x,h&mask);
0067 });
0068 return res;
0069 }
0070 };
0071
0072 }
0073 }
0074 #endif