Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
501}502return true;503}504/** Check if bitset a is a subset of bitset b (= every 1 bit in a is also in b). */505constexpr bool IsSubsetOf(const MultiIntBitSet& a) const noexcept506{507for (unsigned i = 0; i < N; ++i) {508if (m_val[i] & ~a.m_val[i]) return false;509}510return true;511}512/** Check if bitset a and bitset b are identical. */513friend constexpr bool operator==(const MultiIntBitSet& a, const MultiIntBitSet& b) noexcept = default;514/** Swap two bitsets. */515friend constexpr void swap(MultiIntBitSet& a, MultiIntBitSet& b) noexcept { std::swap(a.m_val, b.m_val); }516};518} // namespace bitset_detail520// BitSet dispatches to IntBitSet or MultiIntBitSet as appropriate for the requested minimum number521// of bits. Use IntBitSet up to 32-bit, or up to 64-bit on 64-bit platforms; above that, use a522// MultiIntBitSet of size_t.523template<unsigned BITS>524using BitSet = std::conditional_t<(BITS <= 32), bitset_detail::IntBitSet<uint32_t>,525std::conditional_t<(BITS <= std::numeric_limits<size_t>::digits), bitset_detail::IntBitSet<size_t>,526bitset_detail::MultiIntBitSet<size_t, CeilDiv(BITS, size_t{std::numeric_limits<size_t>::digits})>>>;528#endif // BITCOIN_UTIL_BITSET_H
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.