Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58259 - in sandbox/chrono: boost boost/chrono libs/chrono/test
From: vicente.botet_at_[hidden]
Date: 2009-12-09 20:23:12


Author: viboes
Date: 2009-12-09 20:23:11 EST (Wed, 09 Dec 2009)
New Revision: 58259
URL: http://svn.boost.org/trac/boost/changeset/58259

Log:
Boost.Chrono: Version 0.2.1, Bug fixes
* Replace INTMAC_C by BOOST_INTMAC_C.
* Define BOOST_CHRONO_HAS_CLOCK_MONOTONIC when BOOST_CHRONO_WINDOWS_API
Text files modified:
   sandbox/chrono/boost/chrono/chrono.hpp | 2
   sandbox/chrono/boost/chrono/config.hpp | 2
   sandbox/chrono/boost/ratio.hpp | 48 ++++++++++++++++++++++-----------------
   sandbox/chrono/libs/chrono/test/ratio_fail_test1.cpp | 4 +-
   sandbox/chrono/libs/chrono/test/ratio_test.cpp | 6 ++--
   5 files changed, 34 insertions(+), 28 deletions(-)

Modified: sandbox/chrono/boost/chrono/chrono.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/chrono.hpp (original)
+++ sandbox/chrono/boost/chrono/chrono.hpp 2009-12-09 20:23:11 EST (Wed, 09 Dec 2009)
@@ -82,7 +82,7 @@
 
 #ifdef BOOST_CHRONO_WINDOWS_API
 // The system_clock tick is 100 nanoseconds
-# define BOOST_SYSTEM_CLOCK_DURATION duration<boost::int_least64_t, ratio<INTMAX_C(1), INTMAX_C(10000000)> >
+# define BOOST_SYSTEM_CLOCK_DURATION duration<boost::int_least64_t, ratio<BOOST_INTMAX_C(1), BOOST_INTMAX_C(10000000)> >
 #else
 # define BOOST_SYSTEM_CLOCK_DURATION boost::chrono::nanoseconds
 #endif

Modified: sandbox/chrono/boost/chrono/config.hpp
==============================================================================
--- sandbox/chrono/boost/chrono/config.hpp (original)
+++ sandbox/chrono/boost/chrono/config.hpp 2009-12-09 20:23:11 EST (Wed, 09 Dec 2009)
@@ -33,7 +33,7 @@
 # elif !defined( BOOST_CHRONO_WINDOWS_API ) && !defined( BOOST_CHRONO_MAC_API ) && !defined( BOOST_CHRONO_POSIX_API )
 # if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32))
 # define BOOST_CHRONO_WINDOWS_API
-# define BOOST_HAS_CLOCK_MONOTONIC
+# define BOOST_CHRONO_HAS_CLOCK_MONOTONIC
 # elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
 # define BOOST_CHRONO_MAC_API
 # define BOOST_CHRONO_HAS_CLOCK_MONOTONIC

Modified: sandbox/chrono/boost/ratio.hpp
==============================================================================
--- sandbox/chrono/boost/ratio.hpp (original)
+++ sandbox/chrono/boost/ratio.hpp 2009-12-09 20:23:11 EST (Wed, 09 Dec 2009)
@@ -37,6 +37,12 @@
 #include <boost/type_traits.hpp>
 #include <boost/utility/enable_if.hpp>
 
+#ifdef INTMAX_C
+#define BOOST_INTMAX_C(a) INTMAX_C(a)
+#else
+#define BOOST_INTMAX_C(a) a##LL
+#endif
+
 namespace boost
 {
 
@@ -63,22 +69,22 @@
 template <class R1, class R2> struct ratio_greater_equal;
 
 // convenience SI typedefs
-typedef ratio<INTMAX_C(1), INTMAX_C(1000000000000000000)> atto;
-typedef ratio<INTMAX_C(1), INTMAX_C(1000000000000000)> femto;
-typedef ratio<INTMAX_C(1), INTMAX_C(1000000000000)> pico;
-typedef ratio<INTMAX_C(1), INTMAX_C(1000000000)> nano;
-typedef ratio<INTMAX_C(1), INTMAX_C(1000000)> micro;
-typedef ratio<INTMAX_C(1), INTMAX_C(1000)> milli;
-typedef ratio<INTMAX_C(1), INTMAX_C(100)> centi;
-typedef ratio<INTMAX_C(1), INTMAX_C(10)> deci;
-typedef ratio< INTMAX_C(10), INTMAX_C(1)> deca;
-typedef ratio< INTMAX_C(100), INTMAX_C(1)> hecto;
-typedef ratio< INTMAX_C(1000), INTMAX_C(1)> kilo;
-typedef ratio< INTMAX_C(1000000), INTMAX_C(1)> mega;
-typedef ratio< INTMAX_C(1000000000), INTMAX_C(1)> giga;
-typedef ratio< INTMAX_C(1000000000000), INTMAX_C(1)> tera;
-typedef ratio< INTMAX_C(1000000000000000), INTMAX_C(1)> peta;
-typedef ratio<INTMAX_C(1000000000000000000), INTMAX_C(1)> exa;
+typedef ratio<BOOST_INTMAX_C(1), BOOST_INTMAX_C(1000000000000000000)> atto;
+typedef ratio<BOOST_INTMAX_C(1), BOOST_INTMAX_C(1000000000000000)> femto;
+typedef ratio<BOOST_INTMAX_C(1), BOOST_INTMAX_C(1000000000000)> pico;
+typedef ratio<BOOST_INTMAX_C(1), BOOST_INTMAX_C(1000000000)> nano;
+typedef ratio<BOOST_INTMAX_C(1), BOOST_INTMAX_C(1000000)> micro;
+typedef ratio<BOOST_INTMAX_C(1), BOOST_INTMAX_C(1000)> milli;
+typedef ratio<BOOST_INTMAX_C(1), BOOST_INTMAX_C(100)> centi;
+typedef ratio<BOOST_INTMAX_C(1), BOOST_INTMAX_C(10)> deci;
+typedef ratio< BOOST_INTMAX_C(10), BOOST_INTMAX_C(1)> deca;
+typedef ratio< BOOST_INTMAX_C(100), BOOST_INTMAX_C(1)> hecto;
+typedef ratio< BOOST_INTMAX_C(1000), BOOST_INTMAX_C(1)> kilo;
+typedef ratio< BOOST_INTMAX_C(1000000), BOOST_INTMAX_C(1)> mega;
+typedef ratio< BOOST_INTMAX_C(1000000000), BOOST_INTMAX_C(1)> giga;
+typedef ratio< BOOST_INTMAX_C(1000000000000), BOOST_INTMAX_C(1)> tera;
+typedef ratio< BOOST_INTMAX_C(1000000000000000), BOOST_INTMAX_C(1)> peta;
+typedef ratio<BOOST_INTMAX_C(1000000000000000000), BOOST_INTMAX_C(1)> exa;
 
 //----------------------------------------------------------------------------//
 // helpers //
@@ -128,7 +134,7 @@
   class ll_add<X, Y, 1>
   {
       static const boost::intmax_t min =
- (INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1)) + 1;
+ (BOOST_INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1)) + 1;
       static const boost::intmax_t max = -min;
 
       static char test[X <= max - Y];
@@ -148,7 +154,7 @@
   class ll_add<X, Y, -1>
   {
       static const boost::intmax_t min =
- (INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1)) + 1;
+ (BOOST_INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1)) + 1;
       static const boost::intmax_t max = -min;
 
       static char test[min - Y <= X];
@@ -164,7 +170,7 @@
   class ll_sub<X, Y, 1>
   {
       static const boost::intmax_t min =
- (INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1)) + 1;
+ (BOOST_INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1)) + 1;
       static const boost::intmax_t max = -min;
 
       static char test[min + Y <= X];
@@ -184,7 +190,7 @@
   class ll_sub<X, Y, -1>
   {
       static const boost::intmax_t min =
- (INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1)) + 1;
+ (BOOST_INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1)) + 1;
       static const boost::intmax_t max = -min;
 
       static char test[X <= max + Y];
@@ -197,7 +203,7 @@
   class ll_mul
   {
       static const boost::intmax_t nan =
- (INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1));
+ (BOOST_INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1));
       static const boost::intmax_t min = nan + 1;
       static const boost::intmax_t max = -min;
       static const boost::intmax_t a_x = static_abs<X>::value;

Modified: sandbox/chrono/libs/chrono/test/ratio_fail_test1.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/ratio_fail_test1.cpp (original)
+++ sandbox/chrono/libs/chrono/test/ratio_fail_test1.cpp 2009-12-09 20:23:11 EST (Wed, 09 Dec 2009)
@@ -7,6 +7,6 @@
 
 #include <boost/ratio.hpp>
 
-typedef boost::ratio<INTMAX_C(0x7FFFFFFFFFFFFFFF), INTMAX_C(0x7FFFFFFFFFFFFFF0)> R1;
-typedef boost::ratio<INTMAX_C(0x7FFFFFFFFFFFFFFE), INTMAX_C(0x7FFFFFFFFFFFFFF0)> R2;
+typedef boost::ratio<BOOST_INTMAX_C(0x7FFFFFFFFFFFFFFF), BOOST_INTMAX_C(0x7FFFFFFFFFFFFFF0)> R1;
+typedef boost::ratio<BOOST_INTMAX_C(0x7FFFFFFFFFFFFFFE), BOOST_INTMAX_C(0x7FFFFFFFFFFFFFF0)> R2;
 typedef boost::ratio_multiply<R1, R2>::type RT;

Modified: sandbox/chrono/libs/chrono/test/ratio_test.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/ratio_test.cpp (original)
+++ sandbox/chrono/libs/chrono/test/ratio_test.cpp 2009-12-09 20:23:11 EST (Wed, 09 Dec 2009)
@@ -29,7 +29,7 @@
 
 // Test the case described in library working group issue 948.
 
-typedef boost::ratio<INTMAX_C(0x7FFFFFFFFFFFFFFF), INTMAX_C(0x7FFFFFFFFFFFFFF0)> R1;
+typedef boost::ratio<BOOST_INTMAX_C(0x7FFFFFFFFFFFFFFF), BOOST_INTMAX_C(0x7FFFFFFFFFFFFFF0)> R1;
 typedef boost::ratio<8, 7> R2;
 typedef boost::ratio_multiply<R1, R2>::type RT;
 
@@ -214,8 +214,8 @@
 
 int main()
 {
- typedef boost::ratio<8, INTMAX_C(0x7FFFFFFFD)> R1;
- typedef boost::ratio<3, INTMAX_C(0x7FFFFFFFD)> R2;
+ typedef boost::ratio<8, BOOST_INTMAX_C(0x7FFFFFFFD)> R1;
+ typedef boost::ratio<3, BOOST_INTMAX_C(0x7FFFFFFFD)> R2;
     typedef User1::quantity<boost::ratio_subtract<boost::ratio<0>, boost::ratio<1> >::type,
                              boost::ratio_subtract<boost::ratio<1>, boost::ratio<0> >::type > RR;
     typedef boost::ratio_subtract<R1, R2>::type RS;


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