PATCH: Small merge speed up
H. J. Lu
hjl@lucon.org
Mon May 9 06:56:00 GMT 2005
Does this get the same values faster?
H.J.
----
2005-05-08 H.J. Lu <hongjiu.lu@intel.com>
* merge.c (sec_merge_hash_lookup): Simplify length calculation.
--- bfd/merge.c.hash 2005-05-05 09:15:32.000000000 -0700
+++ bfd/merge.c 2005-05-08 20:38:36.000000000 -0700
@@ -150,12 +150,14 @@ sec_merge_hash_lookup (struct sec_merge_
{
hash += c + (c << 17);
hash ^= hash >> 2;
- ++len;
}
+ len = (s - (const unsigned char *) string) - 1;
hash += len + (len << 17);
}
else
{
+ unsigned int num;
+
for (;;)
{
for (i = 0; i < table->entsize; ++i)
@@ -169,10 +171,10 @@ sec_merge_hash_lookup (struct sec_merge_
hash += c + (c << 17);
hash ^= hash >> 2;
}
- ++len;
}
- hash += len + (len << 17);
- len *= table->entsize;
+ len = (s - (const unsigned char *) string);
+ num = len / table->entsize;
+ hash += num + (num << 17);
}
hash ^= hash >> 2;
len += table->entsize;
More information about the Binutils
mailing list