Boost logo

Boost :

From: Bo Persson (bop_at_[hidden])
Date: 2008-04-19 14:38:10


Giovanni Piero Deretta wrote:
> On Sat, Apr 19, 2008 at 5:30 PM, Bo Persson <bop_at_[hidden]> wrote:
>>
>> Giovanni Piero Deretta wrote:
>> > On Fri, Apr 18, 2008 at 5:34 PM, Matt Doyle <mdoyle_at_[hidden]>
>> > wrote:
>> >>> [mailto:boost-bounces_at_[hidden]] 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.

Bo Persson


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk