Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65477 - sandbox/chrono/boost/ratio
From: vicente.botet_at_[hidden]
Date: 2010-09-20 06:53:22


Author: viboes
Date: 2010-09-20 06:53:17 EDT (Mon, 20 Sep 2010)
New Revision: 65477
URL: http://svn.boost.org/trac/boost/changeset/65477

Log:
Ratio cleanup
Text files modified:
   sandbox/chrono/boost/ratio/ratio.hpp | 43 ++-------------------------------------
   1 files changed, 3 insertions(+), 40 deletions(-)

Modified: sandbox/chrono/boost/ratio/ratio.hpp
==============================================================================
--- sandbox/chrono/boost/ratio/ratio.hpp (original)
+++ sandbox/chrono/boost/ratio/ratio.hpp 2010-09-20 06:53:17 EDT (Mon, 20 Sep 2010)
@@ -50,7 +50,6 @@
 
 #if !defined(BOOST_NO_STATIC_ASSERT) || !defined(BOOST_RATIO_USES_MPL_ASSERT)
 #define BOOST_RATIO_OVERFLOW_IN_ADD "overflow in ratio add"
-#define BOOST_RATIO_OVERFLOW_IN_ADD "overflow in ratio add"
 #define BOOST_RATIO_OVERFLOW_IN_SUB "overflow in ratio sub"
 #define BOOST_RATIO_OVERFLOW_IN_MUL "overflow in ratio mul"
 #define BOOST_RATIO_OVERFLOW_IN_DIV "overflow in ratio div"
@@ -185,14 +184,8 @@
   template <boost::intmax_t X, boost::intmax_t Y>
   class ll_add<X, Y, 1>
   {
- #if BOOST_RATIO_OLD_MIN_MAX
- static const boost::intmax_t min =
- (BOOST_INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1)) + 1;
- static const boost::intmax_t max = -min;
- #else
       static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min;
       static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max;
- #endif
 
       BOOST_RATIO_STATIC_ASSERT(X <= max - Y , BOOST_RATIO_OVERFLOW_IN_ADD, ());
   public:
@@ -209,14 +202,8 @@
   template <boost::intmax_t X, boost::intmax_t Y>
   class ll_add<X, Y, -1>
   {
- #if BOOST_RATIO_OLD_MIN_MAX
- static const boost::intmax_t min =
- (BOOST_INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1)) + 1;
- static const boost::intmax_t max = -min;
- #else
       static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min;
       static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max;
- #endif
 
       BOOST_RATIO_STATIC_ASSERT(min - Y <= X, BOOST_RATIO_OVERFLOW_IN_ADD, ());
   public:
@@ -229,14 +216,8 @@
   template <boost::intmax_t X, boost::intmax_t Y>
   class ll_sub<X, Y, 1>
   {
- #if BOOST_RATIO_OLD_MIN_MAX
- static const boost::intmax_t min =
- (BOOST_INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1)) + 1;
- static const boost::intmax_t max = -min;
- #else
       static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min;
       static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max;
- #endif
 
       BOOST_RATIO_STATIC_ASSERT(min + Y <= X, BOOST_RATIO_OVERFLOW_IN_SUB, ());
   public:
@@ -253,14 +234,8 @@
   template <boost::intmax_t X, boost::intmax_t Y>
   class ll_sub<X, Y, -1>
   {
- #if BOOST_RATIO_OLD_MIN_MAX
- static const boost::intmax_t min =
- (BOOST_INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1)) + 1;
- static const boost::intmax_t max = -min;
- #else
       static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min;
       static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max;
- #endif
 
       BOOST_RATIO_STATIC_ASSERT(X <= max + Y, BOOST_RATIO_OVERFLOW_IN_SUB, ());
   public:
@@ -272,21 +247,14 @@
   {
       static const boost::intmax_t nan =
         (BOOST_INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1));
- #if BOOST_RATIO_OLD_MIN_MAX
- static const boost::intmax_t min = nan + 1;
- static const boost::intmax_t max = -min;
- #else
       static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min;
       static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max;
- #endif
 
       static const boost::intmax_t a_x = static_abs<X>::value;
       static const boost::intmax_t a_y = static_abs<Y>::value;
 
       BOOST_RATIO_STATIC_ASSERT(X != nan, BOOST_RATIO_OVERFLOW_IN_MUL, ());
       BOOST_RATIO_STATIC_ASSERT(Y != nan, BOOST_RATIO_OVERFLOW_IN_MUL, ());
- //~ BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (a_x <= max / a_y) >::type::value, BOOST_RATIO_OVERFLOW_IN_MUL, (boost::mpl::integral_c< int, (a_x <= max / a_y) >));
- //~ BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (a_x <= max / a_y) >::type::value, BOOST_RATIO_OVERFLOW_IN_MUL, (boost::mpl::bool_< (a_x <= max / a_y) >::type));
       BOOST_RATIO_STATIC_ASSERT(a_x <= max / a_y, BOOST_RATIO_OVERFLOW_IN_MUL, ());
   public:
       static const boost::intmax_t value = X * Y;
@@ -318,13 +286,8 @@
   class ll_div
   {
       static const boost::intmax_t nan = (1LL << (sizeof(boost::intmax_t) * CHAR_BIT - 1));
- #if BOOST_RATIO_OLD_MIN_MAX
- static const boost::intmax_t min = nan + 1;
- static const boost::intmax_t max = -min;
- #else
       static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min;
       static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max;
- #endif
 
       BOOST_RATIO_STATIC_ASSERT(X != nan, BOOST_RATIO_OVERFLOW_IN_DIV, ());
       BOOST_RATIO_STATIC_ASSERT(Y != nan, BOOST_RATIO_OVERFLOW_IN_DIV, ());
@@ -602,8 +565,8 @@
 
 } // namespace boost
 
-#ifdef BOOST_RATIO_STATIC_ASSERT
-#undef BOOST_RATIO_STATIC_ASSERT
-#endif
+//~ #ifdef BOOST_RATIO_STATIC_ASSERT
+//~ #undef BOOST_RATIO_STATIC_ASSERT
+//~ #endif
 
 #endif // BOOST_RATIO_HPP


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