From: Paul Eggert Date: Sat, 5 Oct 2002 05:02:30 +0000 (+0000) Subject: * lib/bbitset.h (BITSET_WINDEX_MAX): Redefine so that it cannot be X-Git-Tag: BISON-1_75~66 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/5beedd9b5893e470464830e733f3e0d8eb00c158 * lib/bbitset.h (BITSET_WINDEX_MAX): Redefine so that it cannot be interpreted as signed. * lib/ebitset.c (ebitset_list): Fix bug. From Michael Hayes. --- diff --git a/lib/bbitset.h b/lib/bbitset.h index 878f91a4..455fbbcb 100644 --- a/lib/bbitset.h +++ b/lib/bbitset.h @@ -63,7 +63,10 @@ typedef size_t bitset_windex; /* Maximum values for commonly-used unsigned types. BITSET_SIZE_MAX always equals SIZE_MAX, but some older systems lack SIZE_MAX. */ #define BITSET_BINDEX_MAX ((bitset_bindex) -1) -#define BITSET_WINDEX_MAX ((bitset_windex) -1) + +/* Limit max word index to the maximum value of a signed integer + to simplify cache disabling. */ +#define BITSET_WINDEX_MAX (((bitset_windex) -1) >> 1) #define BITSET_SIZE_MAX ((size_t) -1) #define BITSET_MSB ((bitset_word) 1 << (BITSET_WORD_BITS - 1)) diff --git a/lib/ebitset.c b/lib/ebitset.c index 2d9493d5..3fea4afd 100644 --- a/lib/ebitset.c +++ b/lib/ebitset.c @@ -771,7 +771,7 @@ ebitset_list (bset, list, num, next) bitset_word *srcp = EBITSET_WORDS (elt); windex = bitno / BITSET_WORD_BITS; - woffset = eindex / EBITSET_ELT_WORDS; + woffset = eindex * EBITSET_ELT_WORDS; for (; (windex - woffset) < EBITSET_ELT_WORDS; windex++) {