[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: More bitset patches for 64-bit hosts
From: |
Michael Hayes |
Subject: |
Re: More bitset patches for 64-bit hosts |
Date: |
Sat, 05 Oct 2002 16:58:47 +1200 |
Paul Eggert writes:
> There might be one little interface gotcha here, since this patch does
> a xalloc_die () when memory-size calculations overflow. Bison and
> many other GNU utilities have an xalloc_die along with xmalloc, and it
> is the tradition to call xalloc_die () when asked to allocate more
> than SIZE_MAX bytes, but I don't know if that's part of the bitset
> code's interface spec.
Yeah, this bit me building gcc. The xmalloc routines in libiberty
that GCC uses have a similar but different xmalloc_failed routine.
Your latest patch for 64-bit support broke the bitset cache disabling
code for ebitsets. I've attached a fix for this and for another bug I
found with some regression test code.
Michael.
2002-10-05 Michael Hayes <address@hidden>
* lib/bbitset.h (BITSET_WINDEX_MAX): Redefine so that it cannot be
interpreted as signed.
* lib/ebitset.c (ebitset_list): Fix bug.
diff -c3p lib-orig/ebitset.c lib/ebitset.c
*** lib-orig/ebitset.c Wed Oct 2 19:57:24 2002
--- lib/ebitset.c Sat Oct 5 12:17:48 2002
*************** ebitset_list (bset, list, num, next)
*** 771,777 ****
bitset_word *srcp = EBITSET_WORDS (elt);
windex = bitno / BITSET_WORD_BITS;
! woffset = eindex / EBITSET_ELT_WORDS;
for (; (windex - woffset) < EBITSET_ELT_WORDS; windex++)
{
--- 771,777 ----
bitset_word *srcp = EBITSET_WORDS (elt);
windex = bitno / BITSET_WORD_BITS;
! woffset = eindex * EBITSET_ELT_WORDS;
for (; (windex - woffset) < EBITSET_ELT_WORDS; windex++)
{
*** lib-orig/bbitset.h Wed Oct 2 19:44:07 2002
--- lib/bbitset.h Sat Oct 5 12:46:48 2002
*************** typedef size_t bitset_windex;
*** 63,69 ****
/* 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)
#define BITSET_SIZE_MAX ((size_t) -1)
#define BITSET_MSB ((bitset_word) 1 << (BITSET_WORD_BITS - 1))
--- 63,72 ----
/* 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)
!
! /* 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))