
On Sat, Apr 19, 2008 at 8:38 PM, Bo Persson <bop@gmb.dk> wrote:
Giovanni Piero Deretta wrote:
On Sat, Apr 19, 2008 at 5:30 PM, Bo Persson <bop@gmb.dk> wrote:
Giovanni Piero Deretta wrote:
On Fri, Apr 18, 2008 at 5:34 PM, Matt Doyle <mdoyle@a-m-c.com> wrote:
[mailto:boost-bounces@lists.boost.org] On Behalf Of Giovanni Piero Deretta
Changing:
inline std::size_t float_hash_impl(float v) { boost::uint32_t* ptr = (boost::uint32_t*)&v; std::size_t seed = *ptr; return seed; }
to
inline std::size_t float_hash_impl(float v) { std::size_t seed; std::memcpy(&x, &v, sizeof(x)); return seed; }
/x/seed/ ??
Yes, of course :)
And also assuming that sizeof(seed) ==sizeof(float) ?
Yes, but, as the code is only compiled in when under X86, you can safely assume that.
Ok, I though it was used for x86_64 as well, but I might be wrong.
If I have read the preprocessor conditionals correctly, oddly enough it will enabled only on cygwin/x86. In theory the same code should work for all gccs (it should work for all x86 compilers in fact). And yes, it will break for x86_64 cpus, where size_t is 64 bits, but that is easily fixed. -- gpd