19 Apr
                
                    2008
                
            
            
                19 Apr
                
                '08
                
            
            
            
        
    
                1:45 a.m.
            
        On Friday 18 April 2008, Giovanni Piero Deretta wrote:
inline std::size_t float_hash_impl(float v) { std::size_t seed; std::memcpy(&x, &v, sizeof(x)); return seed; }
should work and should produce optimal code, at least with a recent gcc.
Wouldn't casting using union be safe and efficient in all cases? Something like: inline std::size_t float_hash_impl(float v) { union { float v; std::size_t seed; } u; u.v = v; return u.seed; } Teemu