same width as int.
(ebitset_op1): Use -1, not ~0, as memset arg (for portability to one's
complement hosts!).
ebitset_elt_find (dst, windex, EBITSET_CREATE);
ebitset_elt_find (dst, windex, EBITSET_CREATE);
- dst->b.cdata[windex - dst->b.cindex] |= (1 << (bitno % BITSET_WORD_BITS));
+ dst->b.cdata[windex - dst->b.cindex] |=
+ (bitset_word) 1 << (bitno % BITSET_WORD_BITS);
if (!ebitset_elt_find (dst, windex, EBITSET_FIND))
return;
if (!ebitset_elt_find (dst, windex, EBITSET_FIND))
return;
- dst->b.cdata[windex - dst->b.cindex] &= ~(1 << (bitno % BITSET_WORD_BITS));
+ dst->b.cdata[windex - dst->b.cindex] &=
+ ~((bitset_word) 1 << (bitno % BITSET_WORD_BITS));
/* If all the data is zero, perhaps we should remove it now...
However, there is a good chance that the element will be needed
/* If all the data is zero, perhaps we should remove it now...
However, there is a good chance that the element will be needed
bitset_windex woffset;
bitset_bindex count;
bitset_windex size;
bitset_windex woffset;
bitset_bindex count;
bitset_windex size;
ebitset_elts *elts;
if (EBITSET_OP_ZERO_P (bset))
ebitset_elts *elts;
if (EBITSET_OP_ZERO_P (bset))
bcount = bitno % BITSET_WORD_BITS;
boffset = windex * BITSET_WORD_BITS;
bcount = bitno % BITSET_WORD_BITS;
boffset = windex * BITSET_WORD_BITS;
- for (; eindex != ~0U;
- boffset = eindex * EBITSET_ELT_BITS - BITSET_WORD_BITS, eindex--)
- if (!elt)
- continue;
-
- srcp = EBITSET_WORDS (elt);
-
- for (; woffset != ~0U; woffset--, boffset -= BITSET_WORD_BITS,
- bcount = BITSET_WORD_BITS - 1)
- word = srcp[woffset] << (BITSET_WORD_BITS - 1 - bcount);
+ bitset_word *srcp;
+
+ srcp = EBITSET_WORDS (elt);
+ bitset_word word;
+
+ word = srcp[woffset] << (BITSET_WORD_BITS - 1 - bcount);
+
+ for (; word; bcount--)
- list[count++] = boffset + bcount;
- if (count >= num)
- *next = n_bits - (boffset + bcount);
- return count;
+ list[count++] = boffset + bcount;
+ if (count >= num)
+ {
+ *next = n_bits - (boffset + bcount);
+ return count;
+ }
+
+ boffset -= BITSET_WORD_BITS;
+ bcount = BITSET_WORD_BITS - 1;
+ while (woffset--);
+
+ woffset = EBITSET_ELT_WORDS;
- woffset = EBITSET_ELT_WORDS;
+ boffset = eindex * EBITSET_ELT_BITS - BITSET_WORD_BITS;
*next = n_bits - (boffset + 1);
return count;
*next = n_bits - (boffset + 1);
return count;
we should just add pointers to a ones element. */
elt =
ebitset_elt_find (dst, j * EBITSET_ELT_WORDS, EBITSET_CREATE);
we should just add pointers to a ones element. */
elt =
ebitset_elt_find (dst, j * EBITSET_ELT_WORDS, EBITSET_CREATE);
- memset (EBITSET_WORDS (elt), ~0, sizeof (EBITSET_WORDS (elt)));
+ memset (EBITSET_WORDS (elt), -1, sizeof (EBITSET_WORDS (elt)));