/**
  * Returns the popcount or cardinality of the exclusive-or of the two sets. Neither set is
  * modified.
  */
 public static long xorCount(BitSet a, BitSet b) {
   long tot =
       BitUtil.pop_xor(a.getBits(), b.getBits(), 0, Math.min(a.getNumWords(), b.getNumWords()));
   if (a.getNumWords() < b.getNumWords()) {
     tot += BitUtil.pop_array(b.getBits(), a.getNumWords(), b.getNumWords() - a.getNumWords());
   } else if (a.getNumWords() > b.getNumWords()) {
     tot += BitUtil.pop_array(a.getBits(), b.getNumWords(), a.getNumWords() - b.getNumWords());
   }
   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(BitSet a, BitSet b) {
   long tot =
       BitUtil.pop_andnot(a.getBits(), b.getBits(), 0, Math.min(a.getNumWords(), b.getNumWords()));
   if (a.getNumWords() > b.getNumWords()) {
     tot += BitUtil.pop_array(a.getBits(), b.getNumWords(), a.getNumWords() - b.getNumWords());
   }
   return tot;
 }
 /** @return the number of set bits */
 public long cardinality() {
   return BitUtil.pop_array(myBits, 0, myNumWords);
 }