diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2002-08-12 14:13:56 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2002-08-12 14:13:56 +0000 |
commit | 50f095c92f5585ea3cdc07c1aec7d9fa9510b61a (patch) | |
tree | 33d56e986f74092346ca6da7501518a063d6f3fa | |
parent | 16cb098b72889fff9c43f2e0fa75036d8070c605 (diff) | |
download | bison-50f095c92f5585ea3cdc07c1aec7d9fa9510b61a.tar.gz |
(BITSET_WORD_BITS): Now of type unsigned, not
size_t; the old version tried to do this but casted improperly.
(bitset_bindex, bitset_windex): Now size_t, not unsigned long.
(bitset_test): Now returns int, not unsigned long.
-rw-r--r-- | lib/bbitset.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/bbitset.h b/lib/bbitset.h index 8ea98a8c..1e5710d3 100644 --- a/lib/bbitset.h +++ b/lib/bbitset.h @@ -45,17 +45,19 @@ enum bitset_alloc_type {BITSET_MALLOC, BITSET_OBALLOC}; /* Data type used to store a word of bits. */ typedef unsigned long bitset_word; -#define BITSET_WORD_BITS ((unsigned) CHAR_BIT * sizeof (bitset_word)) +#define BITSET_WORD_BITS ((unsigned) (CHAR_BIT * sizeof (bitset_word))) -/* Bit index. */ -typedef unsigned long bitset_bindex; +/* Bit index. In theory we might need a type wider than size_t, but + in practice we lose at most a factor of CHAR_BIT by going with + size_t, and that is good enough. */ +typedef size_t bitset_bindex; /* Word index. */ -typedef unsigned long bitset_windex; +typedef size_t bitset_windex; -#define BITSET_INDEX_MAX ((1U << (BITSET_WORD_BITS - 1))) +#define BITSET_INDEX_MAX ((bitset_word) 1 << (BITSET_WORD_BITS - 1)) -#define BITSET_MSB (1U << (BITSET_WORD_BITS - 1)) +#define BITSET_MSB ((bitset_word) 1 << (BITSET_WORD_BITS - 1)) #define BITSET_LIST_SIZE 1024 |