summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-08-22 22:29:17 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-08-22 22:29:17 +0000
commitec64a609bf7f60b8d6c0329280df99fbe5d8ca6c (patch)
treec56487fa5d7f717c41116718e450a2f92ae59134
parent3410d87a56fd8b5abd55ddbf80ad7374783bb205 (diff)
downloadppe42-gcc-ec64a609bf7f60b8d6c0329280df99fbe5d8ca6c.tar.gz
ppe42-gcc-ec64a609bf7f60b8d6c0329280df99fbe5d8ca6c.zip
* hashtable.c (ht_expand): Avoid calculating rehash for the common
case that the first probe hits an empty hash table slot. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@70706 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/hashtable.c13
2 files changed, 11 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3dd61eb896a..f97afe2b005 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2003-08-22 Roger Sayle <roger@eyesopen.com>
+
+ * hashtable.c (ht_expand): Avoid calculating rehash for the common
+ case that the first probe hits an empty hash table slot.
+
2003-08-22 Mark Mitchell <mark@codesourcery.com>
* config/ia64/hpux.h (SUPPORTS_INIT_PRIORITY): Define to 0.
diff --git a/gcc/hashtable.c b/gcc/hashtable.c
index 41551394f8a..58f19d055fc 100644
--- a/gcc/hashtable.c
+++ b/gcc/hashtable.c
@@ -184,19 +184,18 @@ ht_expand (hash_table *table)
unsigned int index, hash, hash2;
hash = (*p)->hash_value;
- hash2 = ((hash * 17) & sizemask) | 1;
index = hash & sizemask;
- for (;;)
+ if (nentries[index])
{
- if (! nentries[index])
+ hash2 = ((hash * 17) & sizemask) | 1;
+ do
{
- nentries[index] = *p;
- break;
+ index = (index + hash2) & sizemask;
}
-
- index = (index + hash2) & sizemask;
+ while (nentries[index]);
}
+ nentries[index] = *p;
}
while (++p < limit);
OpenPOWER on IntegriCloud