aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-10-18 09:44:50 -0700
committerRichard Henderson <rth@gcc.gnu.org>2004-10-18 09:44:50 -0700
commitb499264121070eb0876ab645d34bea38493c1821 (patch)
treed69684e3420ab79e23d88e244440905e1a2e0765
parentf072a5c8aa3efbd9c9eb804be38c641479fd4061 (diff)
downloadgcc-b499264121070eb0876ab645d34bea38493c1821.zip
gcc-b499264121070eb0876ab645d34bea38493c1821.tar.gz
gcc-b499264121070eb0876ab645d34bea38493c1821.tar.bz2
* pointer-set.c (hash1): Don't use libm functions in fallback case.
From-SVN: r89231
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/pointer-set.c7
2 files changed, 7 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dcd3f1b..8e461b8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2004-10-18 Richard Henderson <rth@redhat.com>
+
+ * pointer-set.c (hash1): Don't use libm functions in fallback case.
+
2004-10-18 H.J. Lu <hongjiu.lu@intel.com>
PR bootstrap/17684
diff --git a/gcc/pointer-set.c b/gcc/pointer-set.c
index f8023c7..b7154de 100644
--- a/gcc/pointer-set.c
+++ b/gcc/pointer-set.c
@@ -61,11 +61,10 @@ hash1 (const void *p, unsigned long max, unsigned long logmax)
#elif HOST_BITS_PER_LONG == 64
const unsigned long A = 0x9e3779b97f4a7c16ul;
#else
- const double M = (ULONG_MAX + 1.0);
- const double B = M / ((sqrt (5) - 1) / 2.0);
- const unsigned long A = B - (floor (B / M) * M);
+ const unsigned long A
+ = (ULONG_MAX + 1.0L) * 0.6180339887498948482045868343656381177203L;
#endif
- const unsigned long shift = sizeof (unsigned long) * CHAR_BIT - logmax;
+ const unsigned long shift = HOST_BITS_PER_LONG - logmax;
return ((A * (unsigned long) p) >> shift) & (max - 1);
}