Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74087 - trunk/boost/unordered/detail
From: dnljms_at_[hidden]
Date: 2011-08-27 07:53:48


Author: danieljames
Date: 2011-08-27 07:53:48 EDT (Sat, 27 Aug 2011)
New Revision: 74087
URL: http://svn.boost.org/trac/boost/changeset/74087

Log:
Unordered: Try to avoid std::size_t to double warnings.

Maybe I should use long double?
Text files modified:
   trunk/boost/unordered/detail/table.hpp | 8 ++++++--
   1 files changed, 6 insertions(+), 2 deletions(-)

Modified: trunk/boost/unordered/detail/table.hpp
==============================================================================
--- trunk/boost/unordered/detail/table.hpp (original)
+++ trunk/boost/unordered/detail/table.hpp 2011-08-27 07:53:48 EDT (Sat, 27 Aug 2011)
@@ -167,7 +167,9 @@
             //
             // Or from rehash post-condition:
             // count > size / mlf_
- return next_prime(double_to_size_t(floor(size / (double) mlf_)) + 1);
+ return next_prime(double_to_size_t(floor(
+ static_cast<double>(size) /
+ static_cast<double>(mlf_))) + 1);
         }
 
         ////////////////////////////////////////////////////////////////////////
@@ -451,7 +453,9 @@
         else {
             // no throw:
             min_buckets = next_prime((std::max)(min_buckets,
- double_to_size_t(floor(this->size_ / (double) mlf_)) + 1));
+ double_to_size_t(floor(
+ static_cast<double>(this->size_) /
+ static_cast<double>(mlf_))) + 1));
             if(min_buckets != this->bucket_count_) {
                 this->rehash_impl(min_buckets);
                 this->max_load_ = calculate_max_load();


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