From c340180d81bf64712d3db24f157cd8030a08633a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 12 Aug 2002 14:22:08 +0000 Subject: [PATCH] (lbitset_set, lbitset_reset): Do not assume that bitset_word is the same width as int. (lbitset_op1): Use -1, not ~0, as memset arg (for portability to one's complement hosts!). --- lib/lbitset.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/lbitset.c b/lib/lbitset.c index 972094bb..f5f8c4fa 100644 --- a/lib/lbitset.c +++ b/lib/lbitset.c @@ -585,7 +585,8 @@ lbitset_set (dst, bitno) lbitset_elt_find (dst, windex, LBITSET_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); } @@ -600,7 +601,8 @@ lbitset_reset (dst, bitno) if (!lbitset_elt_find (dst, windex, LBITSET_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 unlink it now... */ } @@ -951,7 +953,7 @@ lbitset_op1 (dst, op) { /* Create new elements if they cannot be found. */ elt = lbitset_elt_find (dst, i, LBITSET_CREATE); - memset (elt->words, ~0, sizeof (elt->words)); + memset (elt->words, -1, sizeof (elt->words)); } break; -- 2.45.2