Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67393 - sandbox/chrono/boost/static_integer
From: vicente.botet_at_[hidden]
Date: 2010-12-21 16:08:22


Author: viboes
Date: 2010-12-21 16:08:21 EST (Tue, 21 Dec 2010)
New Revision: 67393
URL: http://svn.boost.org/trac/boost/changeset/67393

Log:
StaticInteger: Adapt to the new mpl files
Text files modified:
   sandbox/chrono/boost/static_integer/static_abs.hpp | 36 +++---------------------------------
   sandbox/chrono/boost/static_integer/static_gcd.hpp | 6 ++++--
   sandbox/chrono/boost/static_integer/static_sign.hpp | 7 +++----
   3 files changed, 10 insertions(+), 39 deletions(-)

Modified: sandbox/chrono/boost/static_integer/static_abs.hpp
==============================================================================
--- sandbox/chrono/boost/static_integer/static_abs.hpp (original)
+++ sandbox/chrono/boost/static_integer/static_abs.hpp 2010-12-21 16:08:21 EST (Tue, 21 Dec 2010)
@@ -13,10 +13,10 @@
 #ifndef BOOST_STATIC_INTEGER_STATIC_ABS_HPP
 #define BOOST_STATIC_INTEGER_STATIC_ABS_HPP
 
-#include <boost/cstdint.hpp>
 #include <boost/type_traits/integral_constant.hpp>
 #include <boost/type_traits/is_unsigned.hpp>
 #include <boost/static_integer/static_types.hpp>
+#include <boost/mpl/abs.hpp>
 
 //
 // We simply cannot include this header on gcc without getting copious warnings of the kind:
@@ -35,41 +35,11 @@
 
 namespace integer
 {
-#if BOOST_RATIO_WORK_WITH_MSVC
+
     template <typename T, T X>
     struct static_abs
- : integral_constant<T,
- (X < 0) ? -X : X>
+ : mpl::abs<integral_constant<T, X> >
     {};
-#else
- template <typename T, T X>
- struct static_unary_minus;
-
- template <static_signed_type X>
- struct static_unary_minus<static_signed_type,X> : integral_constant<static_signed_type, -X>
- {};
-
- namespace integer_detail
- {
- template <typename T, T X, bool LT0>
- struct static_abs_aux2 : integral_constant<T, X>
- {};
- template <typename T, T X>
- struct static_abs_aux2<T,X,true> : static_unary_minus<T, X>
- {};
- template <typename T, T X, bool IsUnsigned>
- struct static_abs_aux : integral_constant<T, X>
- {};
- template <typename T, T X>
- struct static_abs_aux<T,X,false> : static_abs_aux2<T, X, (X < 0) >
- {};
- }
-
- template <typename T, T X>
- struct static_abs : integer_detail::static_abs_aux<T, X, is_unsigned<T>::value >
- {};
-
-#endif
         
     template <static_signed_type X>
     struct static_signed_abs

Modified: sandbox/chrono/boost/static_integer/static_gcd.hpp
==============================================================================
--- sandbox/chrono/boost/static_integer/static_gcd.hpp (original)
+++ sandbox/chrono/boost/static_integer/static_gcd.hpp 2010-12-21 16:08:21 EST (Tue, 21 Dec 2010)
@@ -15,7 +15,7 @@
 
 #include <boost/type_traits/integral_constant.hpp>
 #include <boost/static_integer/static_types.hpp>
-#include <boost/cstdint.hpp>
+#include <boost/mpl/gcd.hpp>
 
 //
 // We simply cannot include this header on gcc without getting copious warnings of the kind:
@@ -51,7 +51,9 @@
     {};
 }
     template <typename T, T X, T Y>
- struct static_gcd : integer_detail::static_gcd_aux<T, X==0, X, Y==0, Y>
+ struct static_gcd
+ //~ : integer_detail::static_gcd_aux<T, X==0, X, Y==0, Y>
+ : mpl::gcd<integral_constant<T, X>, integral_constant<T, Y> >
     {};
 
     //~ template <typename T, T X, T Y>

Modified: sandbox/chrono/boost/static_integer/static_sign.hpp
==============================================================================
--- sandbox/chrono/boost/static_integer/static_sign.hpp (original)
+++ sandbox/chrono/boost/static_integer/static_sign.hpp 2010-12-21 16:08:21 EST (Tue, 21 Dec 2010)
@@ -13,9 +13,9 @@
 #ifndef BOOST_STATIC_INTEGER_STATIC_SIGN_HPP
 #define BOOST_STATIC_INTEGER_STATIC_SIGN_HPP
 
-#include <boost/cstdint.hpp>
 #include <boost/type_traits/integral_constant.hpp>
 #include <boost/static_integer/static_types.hpp>
+#include <boost/mpl/sign.hpp>
 
 //
 // We simply cannot include this header on gcc without getting copious warnings of the kind:
@@ -35,12 +35,11 @@
 namespace integer
 {
     template <typename T, T X>
- struct static_sign
- : integral_constant<T, X == 0 ? 0 : (X < 0 ? -1 : 1)>
+ struct static_sign
+ : mpl::sign< integral_constant<T,X> >
     {
     };
     
-
     template <static_signed_type X>
     struct static_signed_sign : static_sign<static_signed_type, X>
     {


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