Pop_union() public static méthode

Returns the popcount or cardinality of the union of two sets. Neither array is modified.
public static Pop_union ( long A, long B, int wordOffset, int numWords ) : long
A long
B long
wordOffset int
numWords int
Résultat long
Exemple #1
0
        /// <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.bits, b.bits, 0, Math.Min(a.Wlen, b.Wlen));

            if (a.Wlen < b.Wlen)
            {
                tot += BitUtil.Pop_array(b.bits, a.Wlen, b.Wlen - a.Wlen);
            }
            else if (a.Wlen > b.Wlen)
            {
                tot += BitUtil.Pop_array(a.bits, b.Wlen, a.Wlen - b.Wlen);
            }
            return(tot);
        }
Exemple #2
0
        /// <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);
        }