summaryrefslogtreecommitdiff
path: root/gcc/pointer-set.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-18 16:44:50 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-18 16:44:50 +0000
commita1f487759c3044b9471a858df8127c6136fd22a1 (patch)
treed69684e3420ab79e23d88e244440905e1a2e0765 /gcc/pointer-set.c
parent20f7449c174d469251f2df152ea1c83e23358e80 (diff)
downloadgcc-a1f487759c3044b9471a858df8127c6136fd22a1.tar.gz
* pointer-set.c (hash1): Don't use libm functions in fallback case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89231 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/pointer-set.c')
-rw-r--r--gcc/pointer-set.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/pointer-set.c b/gcc/pointer-set.c
index f8023c7fc6c..b7154deabd1 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);
}