/** Returns number of set bits. NOTE: this visits every * long in the backing bits array, and the result is not * internally cached! */ public long cardinality() { // Depends on the ghost bits being clear! return BitUtil.pop_array(bits, 0, numWords); }
/** Returns number of set bits. NOTE: this visits every * long in the backing bits array, and the result is not * internally cached! */ @Override public int cardinality() { // Depends on the ghost bits being clear! return (int) BitUtil.pop_array(bits, 0, numWords); }
/** * 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 "a and not b" or * "intersection(a, not(b))". Neither set is modified. */ public static long andNotCount(FixedBitSet a, FixedBitSet b) { // Depends on the ghost bits being clear! long tot = BitUtil.pop_andnot(a.bits, b.bits, 0, Math.min(a.numWords, b.numWords)); if (a.numWords > b.numWords) { tot += BitUtil.pop_array(a.bits, b.numWords, a.numWords - b.numWords); } return tot; }
/** Returns number of set bits. NOTE: this visits every * long in the backing bits array, and the result is not * internally cached! */ public long cardinality() { // Depends on the ghost bits being clear! return BitUtil.pop_array(bits, 0, numWords); }
/** Returns number of set bits. NOTE: this visits every * long in the backing bits array, and the result is not * internally cached! */ public long cardinality() { // Depends on the ghost bits being clear! return BitUtil.pop_array(bits, 0, numWords); }
/** Returns number of set bits. NOTE: this visits every * long in the backing bits array, and the result is not * internally cached! */ @Override public int cardinality() { // Depends on the ghost bits being clear! return (int) BitUtil.pop_array(bits, 0, numWords); }
/** Returns number of set bits. NOTE: this visits every * long in the backing bits array, and the result is not * internally cached! */ public long cardinality() { // Depends on the ghost bits being clear! return BitUtil.pop_array(bits, 0, numWords); }
/** Returns number of set bits. NOTE: this visits every * long in the backing bits array, and the result is not * internally cached! */ @Override public int cardinality() { // Depends on the ghost bits being clear! return (int) BitUtil.pop_array(bits, 0, numWords); }
/** @return the number of set bits */ public long cardinality() { return BitUtil.pop_array(bits,0,wlen); }
/** @return the number of set bits */ public long cardinality() { return BitUtil.pop_array(bits,0,wlen); }
/** Returns the popcount or cardinality of the exclusive-or of the two sets. * Neither set is modified. */ public static long xorCount(OpenBitSet a, OpenBitSet b) { long tot = BitUtil.pop_xor(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(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 exclusive-or of the two sets. * Neither set is modified. */ public static long xorCount(OpenBitSet a, OpenBitSet b) { long tot = BitUtil.pop_xor(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 "a and not b" * or "intersection(a, not(b))". * Neither set is modified. */ public static long andNotCount(OpenBitSet a, OpenBitSet b) { long tot = BitUtil.pop_andnot(a.bits, b.bits, 0, Math.min(a.wlen, b.wlen)); 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 "a and not b" or * "intersection(a, not(b))". Neither set is modified. */ public static long andNotCount(FixedBitSet a, FixedBitSet b) { // Depends on the ghost bits being clear! long tot = BitUtil.pop_andnot(a.bits, b.bits, 0, Math.min(a.numWords, b.numWords)); 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 "a and not b" or * "intersection(a, not(b))". Neither set is modified. */ public static long andNotCount(FixedBitSet a, FixedBitSet b) { // Depends on the ghost bits being clear! long tot = BitUtil.pop_andnot(a.bits, b.bits, 0, Math.min(a.numWords, b.numWords)); 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 "a and not b" or * "intersection(a, not(b))". Neither set is modified. */ public static long andNotCount(FixedBitSet a, FixedBitSet b) { // Depends on the ghost bits being clear! long tot = BitUtil.pop_andnot(a.bits, b.bits, 0, Math.min(a.numWords, b.numWords)); 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 "a and not b" * or "intersection(a, not(b))". * Neither set is modified. */ public static long andNotCount(OpenBitSet a, OpenBitSet b) { long tot = BitUtil.pop_andnot(a.bits, b.bits, 0, Math.min(a.wlen, b.wlen)); if (a.wlen > b.wlen) { tot += BitUtil.pop_array(a.bits, b.wlen, a.wlen-b.wlen); } return tot; }