Commit 4ae2e3e9 by Roger Sayle Committed by Roger Sayle

hashtable.c (ht_expand): Avoid calculating rehash for the common case that the…

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
parent a30f2d65
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> 2003-08-22 Mark Mitchell <mark@codesourcery.com>
* config/ia64/hpux.h (SUPPORTS_INIT_PRIORITY): Define to 0. * config/ia64/hpux.h (SUPPORTS_INIT_PRIORITY): Define to 0.
......
...@@ -184,19 +184,18 @@ ht_expand (hash_table *table) ...@@ -184,19 +184,18 @@ ht_expand (hash_table *table)
unsigned int index, hash, hash2; unsigned int index, hash, hash2;
hash = (*p)->hash_value; hash = (*p)->hash_value;
hash2 = ((hash * 17) & sizemask) | 1;
index = hash & sizemask; index = hash & sizemask;
for (;;) if (nentries[index])
{ {
if (! nentries[index]) hash2 = ((hash * 17) & sizemask) | 1;
do
{ {
nentries[index] = *p; index = (index + hash2) & sizemask;
break;
} }
while (nentries[index]);
index = (index + hash2) & sizemask;
} }
nentries[index] = *p;
} }
while (++p < limit); while (++p < limit);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment