Boost logo

Boost-Commit :

From: daniel_james_at_[hidden]
Date: 2007-09-14 19:22:20


Author: danieljames
Date: 2007-09-14 19:22:18 EDT (Fri, 14 Sep 2007)
New Revision: 39290
URL: http://svn.boost.org/trac/boost/changeset/39290

Log:
Use uint16_t/uint32_t in the binary hash code - it doesn't make it any more portable, just makes the meaning of the code more explicit.
Text files modified:
   branches/hash/boost/functional/detail/hash_float.hpp | 9 +++++----
   1 files changed, 5 insertions(+), 4 deletions(-)

Modified: branches/hash/boost/functional/detail/hash_float.hpp
==============================================================================
--- branches/hash/boost/functional/detail/hash_float.hpp (original)
+++ branches/hash/boost/functional/detail/hash_float.hpp 2007-09-14 19:22:18 EDT (Fri, 14 Sep 2007)
@@ -16,6 +16,7 @@
 
 #include <boost/functional/detail/float_functions.hpp>
 #include <boost/integer/static_log2.hpp>
+#include <boost/cstdint.hpp>
 #include <boost/limits.hpp>
 #include <boost/assert.hpp>
 
@@ -86,14 +87,14 @@
 #if defined(BOOST_HASH_USE_X86)
         inline std::size_t float_hash_impl(float v)
         {
- unsigned* ptr = (unsigned*)&v;
+ boost::uint32_t* ptr = (boost::uint32_t*)&v;
             std::size_t seed = *ptr;
             return seed;
         }
 
         inline std::size_t float_hash_impl(double v)
         {
- unsigned* ptr = (unsigned*)&v;
+ boost::uint32_t* ptr = (boost::uint32_t*)&v;
             std::size_t seed = *ptr++;
             hash_float_combine(seed, *ptr);
             return seed;
@@ -101,10 +102,10 @@
 
         inline std::size_t float_hash_impl(long double v)
         {
- unsigned* ptr = (unsigned*)&v;
+ boost::uint32_t* ptr = (boost::uint32_t*)&v;
             std::size_t seed = *ptr++;
             hash_float_combine(seed, *ptr++);
- hash_float_combine(seed, *(unsigned short*)ptr);
+ hash_float_combine(seed, *(boost::uint16_t*)ptr);
             return seed;
         }
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk