Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67371 - sandbox/chrono/boost/static_integer
From: vicente.botet_at_[hidden]
Date: 2010-12-20 13:40:35


Author: viboes
Date: 2010-12-20 13:40:29 EST (Mon, 20 Dec 2010)
New Revision: 67371
URL: http://svn.boost.org/trac/boost/changeset/67371

Log:
StaticInteger: Add static_types
Added:
   sandbox/chrono/boost/static_integer/static_types.hpp (contents, props changed)
Text files modified:
   sandbox/chrono/boost/static_integer/static_abs.hpp | 15 +++++++--------
   sandbox/chrono/boost/static_integer/static_gcd.hpp | 15 ++++++---------
   sandbox/chrono/boost/static_integer/static_lcm.hpp | 12 +++++-------
   sandbox/chrono/boost/static_integer/static_sign.hpp | 12 +++++-------
   4 files changed, 23 insertions(+), 31 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-20 13:40:29 EST (Mon, 20 Dec 2010)
@@ -16,6 +16,7 @@
 #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>
 
 //
 // We simply cannot include this header on gcc without getting copious warnings of the kind:
@@ -41,13 +42,11 @@
             (X < 0) ? -X : X>
     {};
 #else
- typedef boost::intmax_t static_abs_signed_type;
- typedef boost::uintmax_t static_abs_unsigned_type;
     template <typename T, T X>
     struct static_unary_minus;
         
- template <static_abs_signed_type X>
- struct static_unary_minus<static_abs_signed_type,X> : integral_constant<static_abs_signed_type, -X>
+ template <static_signed_type X>
+ struct static_unary_minus<static_signed_type,X> : integral_constant<static_signed_type, -X>
     {};
 
     namespace integer_detail
@@ -72,14 +71,14 @@
         
 #endif
         
- template <static_abs_signed_type X>
+ template <static_signed_type X>
     struct static_signed_abs
- : static_abs<static_abs_signed_type, X>
+ : static_abs<static_signed_type, X>
     {};
 
- template <static_abs_signed_type X>
+ template <static_signed_type X>
     struct static_unsigned_abs
- : static_abs<static_abs_unsigned_type, X>
+ : static_abs<static_unsigned_type, X>
     {};
 
 

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-20 13:40:29 EST (Mon, 20 Dec 2010)
@@ -14,6 +14,7 @@
 #define BOOST_STATIC_INTEGER_STATIC_GCD_HPP
 
 #include <boost/type_traits/integral_constant.hpp>
+#include <boost/static_integer/static_types.hpp>
 #include <boost/cstdint.hpp>
 
 //
@@ -65,18 +66,14 @@
     //~ template <typename T, T X>
     //~ struct static_gcd<T, T(0), X> : integral_constant<T, X>
     //~ {};
-
- typedef boost::intmax_t static_gcd_signed_type;
- typedef boost::uintmax_t static_gcd_unsigned_type;
-
-
- template <static_gcd_signed_type X, static_gcd_signed_type Y>
- struct static_signed_gcd : static_gcd<static_gcd_signed_type, X, Y>
+
+ template <static_signed_type X, static_signed_type Y>
+ struct static_signed_gcd : static_gcd<static_signed_type, X, Y>
     {};
     
 
- template <static_gcd_unsigned_type X, static_gcd_unsigned_type Y>
- struct static_unsigned_gcd : static_gcd<static_gcd_unsigned_type, X, Y>
+ template <static_unsigned_type X, static_unsigned_type Y>
+ struct static_unsigned_gcd : static_gcd<static_unsigned_type, X, Y>
     {};
     
 }

Modified: sandbox/chrono/boost/static_integer/static_lcm.hpp
==============================================================================
--- sandbox/chrono/boost/static_integer/static_lcm.hpp (original)
+++ sandbox/chrono/boost/static_integer/static_lcm.hpp 2010-12-20 13:40:29 EST (Mon, 20 Dec 2010)
@@ -15,6 +15,7 @@
 
 #include <boost/cstdint.hpp>
 #include <boost/static_integer/static_gcd.hpp>
+#include <boost/static_integer/static_types.hpp>
 #include <boost/type_traits/integral_constant.hpp>
 
 //
@@ -41,15 +42,12 @@
             X / static_gcd<T, X, Y>::value * Y>
     {};
     
- typedef boost::intmax_t static_lcm_signed_type;
- typedef boost::uintmax_t static_lcm_unsigned_type;
-
- template <static_lcm_signed_type X, static_lcm_signed_type Y>
- struct static_signed_lcm : static_lcm<static_lcm_signed_type, X, Y>
+ template <static_signed_type X, static_signed_type Y>
+ struct static_signed_lcm : static_lcm<static_signed_type, X, Y>
     {};
 
- template <static_lcm_unsigned_type X, static_lcm_unsigned_type Y>
- struct static_unsigned_lcm : static_lcm<static_lcm_unsigned_type, X, Y>
+ template <static_unsigned_type X, static_unsigned_type Y>
+ struct static_unsigned_lcm : static_lcm<static_unsigned_type, X, 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-20 13:40:29 EST (Mon, 20 Dec 2010)
@@ -15,6 +15,7 @@
 
 #include <boost/cstdint.hpp>
 #include <boost/type_traits/integral_constant.hpp>
+#include <boost/static_integer/static_types.hpp>
 
 //
 // We simply cannot include this header on gcc without getting copious warnings of the kind:
@@ -39,18 +40,15 @@
     {
     };
     
- typedef boost::intmax_t static_sign_signed_type;
- typedef boost::intmax_t static_sign_unsigned_type;
-
     
- template <static_sign_signed_type X>
- struct static_signed_sign : static_sign<static_sign_signed_type, X>
+ template <static_signed_type X>
+ struct static_signed_sign : static_sign<static_signed_type, X>
     {
     };
 
- template <static_sign_unsigned_type X>
+ template <static_unsigned_type X>
     struct static_unsigned_sign
- : integral_constant<static_sign_unsigned_type, X == 0 ? 0 : 1>
+ : integral_constant<static_unsigned_type, X == 0 ? 0 : 1>
     {
     };
 

Added: sandbox/chrono/boost/static_integer/static_types.hpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/boost/static_integer/static_types.hpp 2010-12-20 13:40:29 EST (Mon, 20 Dec 2010)
@@ -0,0 +1,38 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2010.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/static_integer for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_STATIC_INTEGER_STATIC_TYPES_HPP
+#define BOOST_STATIC_INTEGER_STATIC_TYPES_HPP
+
+#include <boost/cstdint.hpp>
+
+//
+// We simply cannot include this header on gcc without getting copious warnings of the kind:
+//
+// boost/integer.hpp:77:30: warning: use of C99 long long integer constant
+//
+// And yet there is no other reasonable implementation, so we declare this a system header
+// to suppress these warnings.
+//
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+#pragma GCC system_header
+#endif
+
+namespace boost
+{
+namespace integer
+{
+ typedef boost::intmax_t static_signed_type;
+ typedef boost::uintmax_t static_unsigned_type;
+}
+}
+#endif


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