Commit b4992641 by Richard Henderson Committed by Richard Henderson

* pointer-set.c (hash1): Don't use libm functions in fallback case.

From-SVN: r89231
parent f072a5c8
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> 2004-10-18 H.J. Lu <hongjiu.lu@intel.com>
PR bootstrap/17684 PR bootstrap/17684
......
...@@ -61,11 +61,10 @@ hash1 (const void *p, unsigned long max, unsigned long logmax) ...@@ -61,11 +61,10 @@ hash1 (const void *p, unsigned long max, unsigned long logmax)
#elif HOST_BITS_PER_LONG == 64 #elif HOST_BITS_PER_LONG == 64
const unsigned long A = 0x9e3779b97f4a7c16ul; const unsigned long A = 0x9e3779b97f4a7c16ul;
#else #else
const double M = (ULONG_MAX + 1.0); const unsigned long A
const double B = M / ((sqrt (5) - 1) / 2.0); = (ULONG_MAX + 1.0L) * 0.6180339887498948482045868343656381177203L;
const unsigned long A = B - (floor (B / M) * M);
#endif #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); return ((A * (unsigned long) p) >> shift) & (max - 1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment