mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 08:13:02 +00:00
(abitset_reverse_list, ebitset_reverse_list):
Do not assume that bitset_windex is the same width as unsigned. (abitset_unused_clear): Do not assume that bitset_word is the same width as int. (abitset_op1): Use -1, not ~0, as memset arg (for portability to one's complement hosts!).
This commit is contained in:
@@ -208,8 +208,7 @@ abitset_reverse_list (src, list, num, next)
|
|||||||
bitcnt = bitno % BITSET_WORD_BITS;
|
bitcnt = bitno % BITSET_WORD_BITS;
|
||||||
bitoff = windex * BITSET_WORD_BITS;
|
bitoff = windex * BITSET_WORD_BITS;
|
||||||
|
|
||||||
for (; windex != ~0U; windex--, bitoff -= BITSET_WORD_BITS,
|
do
|
||||||
bitcnt = BITSET_WORD_BITS - 1)
|
|
||||||
{
|
{
|
||||||
word = srcp[windex] << (BITSET_WORD_BITS - 1 - bitcnt);
|
word = srcp[windex] << (BITSET_WORD_BITS - 1 - bitcnt);
|
||||||
for (; word; bitcnt--)
|
for (; word; bitcnt--)
|
||||||
@@ -225,7 +224,10 @@ abitset_reverse_list (src, list, num, next)
|
|||||||
}
|
}
|
||||||
word <<= 1;
|
word <<= 1;
|
||||||
}
|
}
|
||||||
|
bitoff -= BITSET_WORD_BITS;
|
||||||
|
bitcnt = BITSET_WORD_BITS - 1;
|
||||||
}
|
}
|
||||||
|
while (windex--);
|
||||||
|
|
||||||
*next = n_bits - (bitoff + 1);
|
*next = n_bits - (bitoff + 1);
|
||||||
return count;
|
return count;
|
||||||
@@ -348,7 +350,7 @@ abitset_unused_clear (dst)
|
|||||||
last_bit = ABITSET_N_BITS (dst) % BITSET_WORD_BITS;
|
last_bit = ABITSET_N_BITS (dst) % BITSET_WORD_BITS;
|
||||||
if (last_bit)
|
if (last_bit)
|
||||||
ABITSET_WORDS (dst)[dst->b.csize - 1] &=
|
ABITSET_WORDS (dst)[dst->b.csize - 1] &=
|
||||||
(bitset_word) ((1 << last_bit) - 1);
|
((bitset_word) 1 << last_bit) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -370,7 +372,7 @@ abitset_op1 (dst, op)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case BITSET_OP_ONES:
|
case BITSET_OP_ONES:
|
||||||
memset (dstp, ~0, bytes);
|
memset (dstp, -1, bytes);
|
||||||
abitset_unused_clear (dst);
|
abitset_unused_clear (dst);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user