|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53888 - in trunk/boost/random: . detail
From: steven_at_[hidden]
Date: 2009-06-13 22:33:23
Author: steven_watanabe
Date: 2009-06-13 22:33:22 EDT (Sat, 13 Jun 2009)
New Revision: 53888
URL: http://svn.boost.org/trac/boost/changeset/53888
Log:
Supress warnings from narrowing conversions.
Text files modified:
trunk/boost/random/detail/signed_unsigned_tools.hpp | 4 ++--
trunk/boost/random/uniform_int.hpp | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
Modified: trunk/boost/random/detail/signed_unsigned_tools.hpp
==============================================================================
--- trunk/boost/random/detail/signed_unsigned_tools.hpp (original)
+++ trunk/boost/random/detail/signed_unsigned_tools.hpp 2009-06-13 22:33:22 EDT (Sat, 13 Jun 2009)
@@ -61,7 +61,7 @@
struct add<T1, T2, /* signed */ false>
{
typedef T2 result_type;
- result_type operator()(T1 x, T2 y) { return x + y; }
+ result_type operator()(T1 x, T2 y) { return T2(x) + y; }
};
template<class T1, class T2>
@@ -71,7 +71,7 @@
result_type operator()(T1 x, T2 y)
{
if (y >= 0)
- return x + y;
+ return T2(x) + y;
// y < 0
if (x >= T1(-(y+1))) // result >= 0 after subtraction
// avoid the nasty two's complement edge case for y == min()
Modified: trunk/boost/random/uniform_int.hpp
==============================================================================
--- trunk/boost/random/uniform_int.hpp (original)
+++ trunk/boost/random/uniform_int.hpp 2009-06-13 22:33:22 EDT (Sat, 13 Jun 2009)
@@ -156,7 +156,7 @@
// mult+mult*brange by (2), (3) (4)
// Therefore result+(eng()-bmin)*mult <
// mult*(brange+1) by (4)
- result += random::detail::subtract<base_result>()(eng(), bmin) * mult;
+ result += static_cast<range_type>(random::detail::subtract<base_result>()(eng(), bmin) * mult);
// equivalent to (mult * (brange+1)) == range+1, but avoids overflow.
if(mult * range_type(brange) == range - mult + 1) {
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