/** * Returns the popcount or cardinality of the union of the two sets. Neither * set is modified. */ public static long unionCount(FixedBitSet a, FixedBitSet b) { // Depends on the ghost bits being clear! 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; }
/** Returns the popcount or cardinality of the union of the two sets. * Neither set is modified. */ 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; }
/** Returns the popcount or cardinality of the union of the two sets. * Neither set is modified. */ 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; }
/** * Returns the popcount or cardinality of the union of the two sets. Neither * set is modified. */ public static long unionCount(FixedBitSet a, FixedBitSet b) { // Depends on the ghost bits being clear! 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; }
/** * Returns the popcount or cardinality of the union of the two sets. Neither * set is modified. */ public static long unionCount(FixedBitSet a, FixedBitSet b) { // Depends on the ghost bits being clear! 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; }
/** * Returns the popcount or cardinality of the union of the two sets. Neither * set is modified. */ public static long unionCount(FixedBitSet a, FixedBitSet b) { // Depends on the ghost bits being clear! 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; }