diff options
author | Roger Sayle <roger@eyesopen.com> | 2003-08-22 22:29:17 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2003-08-22 22:29:17 +0000 |
commit | 4ae2e3e9225dbd7b2eb6d08577b045bd0a0d017f (patch) | |
tree | c56487fa5d7f717c41116718e450a2f92ae59134 /gcc/hashtable.c | |
parent | a30f2d659c606f7c46265eeafcd968b8cf6abd7b (diff) | |
download | gcc-4ae2e3e9225dbd7b2eb6d08577b045bd0a0d017f.zip gcc-4ae2e3e9225dbd7b2eb6d08577b045bd0a0d017f.tar.gz gcc-4ae2e3e9225dbd7b2eb6d08577b045bd0a0d017f.tar.bz2 |
hashtable.c (ht_expand): Avoid calculating rehash for the common case that the first probe hits an empty...
* hashtable.c (ht_expand): Avoid calculating rehash for the common
case that the first probe hits an empty hash table slot.
From-SVN: r70706
Diffstat (limited to 'gcc/hashtable.c')
-rw-r--r-- | gcc/hashtable.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/hashtable.c b/gcc/hashtable.c index 4155139..58f19d0 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); |