This is the mail archive of the
mailing list for the GCC project.
Re: [v3] Fix hash_prime_size_policy_imp for 64-bit machines
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Jonathan Lennox <lennox at cs dot columbia dot edu>
- Cc: "'gcc-patches at gcc dot gnu dot org'" <gcc-patches at gcc dot gnu dot org>, Ami Tavory <atavory at gmail dot com>
- Date: Thu, 22 Jun 2006 16:52:53 +0200
- Subject: Re: [v3] Fix hash_prime_size_policy_imp for 64-bit machines
- References: <449A7CC4.firstname.lastname@example.org> <email@example.com>
Jonathan Lennox wrote:
Yes, I agree a cast to size_t is better, I will do the change. The
problem ultimately is due to the fact that this code is adapted from
tr1::hashatable where there are only unsigned longs involved.
+ /* 30 */ (unsigned long)8589934583ull,
+ /* 31 */ (unsigned long)17179869143ull,
+ /* 32 */ (unsigned long)34359738337ull,
Does this work if sizeof(unsigned long) < sizeof(std::size_t), e.g. 32-bit
long and 64-bit size_t? I don't know if that's a supported configuration,
but it seems like this could be avoided by making just making this cast to
std::size_t in general.