/// <summary> /// Returns the popcount or cardinality of the union of the two sets. Neither /// set is modified. /// </summary> public static long UnionCount(FixedBitSet a, FixedBitSet b) { long tot = BitUtil.Pop_Union(a.bits, b.bits, 0, Math.Min(a.numWords, b.numWords)); if (a.numWords < b.numWords) { tot += BitUtil.Pop_Array(b.bits, a.numWords, b.numWords - a.numWords); } else if (a.numWords > b.numWords) { tot += BitUtil.Pop_Array(a.bits, b.numWords, a.numWords - b.numWords); } return(tot); }
/// <summary> /// Returns the popcount or cardinality of the union of the two sets. /// Neither set is modified. /// </summary> public static long UnionCount(OpenBitSet a, OpenBitSet b) { long tot = BitUtil.Pop_Union(a.m_bits, b.m_bits, 0, Math.Min(a.m_wlen, b.m_wlen)); if (a.m_wlen < b.m_wlen) { tot += BitUtil.Pop_Array(b.m_bits, a.m_wlen, b.m_wlen - a.m_wlen); } else if (a.m_wlen > b.m_wlen) { tot += BitUtil.Pop_Array(a.m_bits, b.m_wlen, a.m_wlen - b.m_wlen); } return(tot); }