Use size_t, not unsigned int, to count bytes.
(bitset_print): Use proper printf format for bitset types.
(bitset_next, bitset_prev, bitset_first, bitset_last):
Return BITSET_BINDEX_MAX (not -1) for no value,
since we now return the bitset_bindex type (not int).
/* Return number of bytes required to create a N_BIT bitset
of TYPE. The bitset may grow to require more bytes than this. */
/* Return number of bytes required to create a N_BIT bitset
of TYPE. The bitset may grow to require more bytes than this. */
bitset_bytes (type, n_bits)
enum bitset_type type;
bitset_bindex n_bits;
{
bitset_bytes (type, n_bits)
enum bitset_type type;
bitset_bindex n_bits;
{
if (bitset_stats_enabled)
return bitset_stats_bytes ();
if (bitset_stats_enabled)
return bitset_stats_bytes ();
bitset_bindex n_bits;
enum bitset_type type;
{
bitset_bindex n_bits;
enum bitset_type type;
{
bitset bset;
bytes = bitset_bytes (type, n_bits);
bitset bset;
bytes = bitset_bytes (type, n_bits);
bitset_bindex n_bits;
enum bitset_type type;
{
bitset_bindex n_bits;
enum bitset_type type;
{
bitset bset;
bytes = bitset_bytes (type, n_bits);
bitset bset;
bytes = bitset_bytes (type, n_bits);
/* Find next bit set in SRC starting from and including BITNO.
/* Find next bit set in SRC starting from and including BITNO.
- Return -1 if SRC empty. */
-int
+ Return BITSET_BINDEX_MAX if SRC empty. */
+bitset_bindex
bitset_next (src, bitno)
bitset src;
bitset_bindex bitno;
bitset_next (src, bitno)
bitset src;
bitset_bindex bitno;
bitset_bindex next = bitno;
if (!bitset_list (src, &val, 1, &next))
bitset_bindex next = bitno;
if (!bitset_list (src, &val, 1, &next))
+ return BITSET_BINDEX_MAX;
return val;
}
/* Find previous bit set in SRC starting from and including BITNO.
return val;
}
/* Find previous bit set in SRC starting from and including BITNO.
- Return -1 if SRC empty. */
-int
+ Return BITSET_BINDEX_MAX if SRC empty. */
+bitset_bindex
bitset_prev (src, bitno)
bitset src;
bitset_bindex bitno;
bitset_prev (src, bitno)
bitset src;
bitset_bindex bitno;
bitset_bindex next = bitno;
if (!bitset_list_reverse (src, &val, 1, &next))
bitset_bindex next = bitno;
if (!bitset_list_reverse (src, &val, 1, &next))
+ return BITSET_BINDEX_MAX;
return val;
}
/* Find first set bit. */
return val;
}
/* Find first set bit. */
bitset_first (src)
bitset src;
{
bitset_first (src)
bitset src;
{
bitset_last (src)
bitset src;
{
bitset_last (src)
bitset src;
{
bitset_iterator iter;
if (verbose)
bitset_iterator iter;
if (verbose)
- fprintf (file, "n_bits = %d, set = {", bitset_size (bset));
+ fprintf (file, "n_bits = %lu, set = {",
+ (unsigned long) bitset_size (bset));
pos = 30;
BITSET_FOR_EACH (iter, bset, i, 0)
pos = 30;
BITSET_FOR_EACH (iter, bset, i, 0)
/* Return number of bits set in bitset SRC. */
/* Return number of bits set in bitset SRC. */
bitset_count_ (src)
bitset src;
{
bitset_bindex list[BITSET_LIST_SIZE];
bitset_bindex next;
bitset_count_ (src)
bitset src;
{
bitset_bindex list[BITSET_LIST_SIZE];
bitset_bindex next;
+ bitset_bindex num;
+ bitset_bindex count;
/* This could be greatly sped up by adding a count method for each
bitset implementation that uses a direct technique (based on
/* This could be greatly sped up by adding a count method for each
bitset implementation that uses a direct technique (based on