From: "H. J. Lu" <hjl@lucon.org>
To: binutils@sources.redhat.com
Subject: PATCH: Small merge speed up
Date: Mon, 09 May 2005 06:56:00 -0000 [thread overview]
Message-ID: <20050509034453.GA29748@lucon.org> (raw)
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;
next reply other threads:[~2005-05-09 3:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-09 6:56 H. J. Lu [this message]
2005-05-09 14:16 ` Alan Modra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050509034453.GA29748@lucon.org \
--to=hjl@lucon.org \
--cc=binutils@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).