From f039c043071f2f55943d052fa7d4ad5f1a67db09 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 10 Dec 2011 11:53:44 -0500 Subject: [PATCH] Optimize generic ELF hash function a bit more --- ChangeLog | 5 +++++ sysdeps/generic/dl-hash.h | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 73e9911..93adebd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-12-10 Ulrich Drepper + + * sysdeps/generic/dl-hash.h (_dl_elf_hash): Lift one operation out of + the inner loop. + 2011-12-06 Andreas Schwab [BZ #13472] diff --git a/sysdeps/generic/dl-hash.h b/sysdeps/generic/dl-hash.h index 28312ca..e0db00e 100644 --- a/sysdeps/generic/dl-hash.h +++ b/sysdeps/generic/dl-hash.h @@ -60,9 +60,12 @@ _dl_elf_hash (const char *name_arg) But the following is equivalent and a lot faster, especially on modern processors. */ - hash ^= hi; hash ^= hi >> 24; } + + /* Second part of the modified formula. This + operation can be lifted outside the loop. */ + hash &= 0x0fffffff; } } } -- 2.7.4