This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Committed] Use special-purpose hash table to speed up walk_tree
On Sat, Oct 16, 2004 at 06:37:12AM -0400, Jakub Jelinek wrote:
> + choice for A is the integer part of (ULONG_MAX + 1.0) / phi, where phi
> + is the golden ratio.
Any reason not to use the computation actually described here?
Otherwise, the ifdef one's fine if you use HOST_BITS_PER_LONG
to choose one of the alternatives exactly:
#if HOST_BITS_PER_LONG == 32
const unsigned long A = 0x9e3779b9u;
#elif HOST_BITS_PER_LONG == 64
const unsigned long A = 0x9e3779b97f4a7c16ul;
#endif
Which will handily not compile if we ever find something else.
r~