aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edelsohn <dje.gcc@gmail.com>2013-05-06 15:40:54 +0000
committerDavid Edelsohn <dje@gcc.gnu.org>2013-05-06 11:40:54 -0400
commitb768e8cf27cd0d48c49cb1c4741d6a39067d0c1d (patch)
tree146705cbed2fdf5ab54949aa16089558e9056763
parentcb3f6a88f6c9cbcfccb171f4c83aa3beb4f59319 (diff)
downloadgcc-b768e8cf27cd0d48c49cb1c4741d6a39067d0c1d.zip
gcc-b768e8cf27cd0d48c49cb1c4741d6a39067d0c1d.tar.gz
gcc-b768e8cf27cd0d48c49cb1c4741d6a39067d0c1d.tar.bz2
hashtab.c (hash_pointer): Remove conditional and avoid unexecuted shift equal to wordsize.
2013-05-06 David Edelsohn <dje.gcc@gmail.com> Peter Bergner <bergner@vnet.ibm.com> Segher Boessenkool <segher@kernel.crashing.org> Jakub Jelinek <jakub@redhat.com> * hashtab.c (hash_pointer): Remove conditional and avoid unexecuted shift equal to wordsize. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> Co-Authored-By: Peter Bergner <bergner@vnet.ibm.com> Co-Authored-By: Segher Boessenkool <segher@kernel.crashing.org> From-SVN: r198633
-rw-r--r--libiberty/ChangeLog8
-rw-r--r--libiberty/hashtab.c13
2 files changed, 10 insertions, 11 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 1420ad4..a30a363 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,11 @@
+2013-05-06 David Edelsohn <dje.gcc@gmail.com>
+ Peter Bergner <bergner@vnet.ibm.com>
+ Segher Boessenkool <segher@kernel.crashing.org>
+ Jakub Jelinek <jakub@redhat.com>
+
+ * hashtab.c (hash_pointer): Remove conditional and avoid
+ unexecuted shift equal to wordsize.
+
2013-04-22 Andi Kleen <ak@linux.intel.com>
* hashtab.c (hash_pointer): Move to end of file and reimplement.
diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c
index a2fe3ee..04607ea 100644
--- a/libiberty/hashtab.c
+++ b/libiberty/hashtab.c
@@ -990,17 +990,8 @@ hash_pointer (const PTR p)
unsigned a, b, c;
a = b = 0x9e3779b9;
- if (sizeof (intptr_t) == 4)
- {
- /* Mix as 16bit for now */
- a += v >> 16;
- b += v & 0xffff;
- }
- else
- {
- a += v >> 32;
- b += v & 0xffffffff;
- }
+ a += v >> (sizeof (intptr_t) * CHAR_BIT / 2);
+ b += v & (((intptr_t) 1 << (sizeof (intptr_t) * CHAR_BIT / 2)) - 1);
c = 0x42135234;
mix (a, b, c);
return c;