/* Set all bits in the bitset to zero. */ static inline void tbitset_zero (bitset bset) { if (EBITSET_ZERO_P (bset)) return; tbitset_elts *elts = EBITSET_ELTS (bset); for (bitset_windex j = 0; j < EBITSET_SIZE (bset); j++) { tbitset_elt *elt = elts[j]; if (elt) tbitset_elt_remove (bset, j); } /* All the bits are zero. We could shrink the elts. For now just mark BSET as known to be zero. */ EBITSET_ZERO_SET (bset); }
/* Weed out the zero elements from the elts. */ static inline bitset_windex ebitset_weed (bitset bset) { ebitset_elts *elts; bitset_windex j; bitset_windex count; if (EBITSET_ZERO_P (bset)) return 0; elts = EBITSET_ELTS (bset); count = 0; for (j = 0; j < EBITSET_SIZE (bset); j++) { ebitset_elt *elt = elts[j]; if (elt) { if (ebitset_elt_zero_p (elt)) { ebitset_elt_remove (bset, j); count++; } } else count++; } count = j - count; if (!count) { /* All the bits are zero. We could shrink the elts. For now just mark BSET as known to be zero. */ EBITSET_ZERO_SET (bset); } else EBITSET_NONZERO_SET (bset); return count; }