Boost logo

Boost-Commit :

From: dwalker07_at_[hidden]
Date: 2008-07-27 13:08:52


Author: dlwalker
Date: 2008-07-27 13:08:51 EDT (Sun, 27 Jul 2008)
New Revision: 47842
URL: http://svn.boost.org/trac/boost/changeset/47842

Log:
Added extended-integer support
Text files modified:
   trunk/boost/integer/integer_mask.hpp | 6 ++++++
   trunk/boost/integer_fwd.hpp | 6 ++++++
   trunk/libs/integer/test/integer_mask_test.cpp | 10 +++++++---
   3 files changed, 19 insertions(+), 3 deletions(-)

Modified: trunk/boost/integer/integer_mask.hpp
==============================================================================
--- trunk/boost/integer/integer_mask.hpp (original)
+++ trunk/boost/integer/integer_mask.hpp 2008-07-27 13:08:51 EDT (Sun, 27 Jul 2008)
@@ -15,6 +15,8 @@
 #include <boost/config.hpp> // for BOOST_STATIC_CONSTANT
 #include <boost/integer.hpp> // for boost::uint_t
 
+#include <boost/detail/extended_integer.hpp> // for BOOST_HAS_XINT, etc.
+
 #include <climits> // for UCHAR_MAX, etc.
 #include <cstddef> // for std::size_t
 
@@ -84,6 +86,10 @@
 BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned long );
 #endif
 
+#if BOOST_HAS_XINT && (BOOST_UXINT_MAX > ULONG_MAX)
+BOOST_LOW_BITS_MASK_SPECIALIZE( ::boost::detail::uxint_t );
+#endif
+
 #undef BOOST_LOW_BITS_MASK_SPECIALIZE
 
 

Modified: trunk/boost/integer_fwd.hpp
==============================================================================
--- trunk/boost/integer_fwd.hpp (original)
+++ trunk/boost/integer_fwd.hpp 2008-07-27 13:08:51 EDT (Sun, 27 Jul 2008)
@@ -155,6 +155,12 @@
     struct low_bits_mask_t< ::std::numeric_limits<unsigned long>::digits >;
 #endif
 
+#if BOOST_HAS_XINT && (BOOST_UXINT_MAX > ULONG_MAX)
+template < >
+ struct low_bits_mask_t< ::std::numeric_limits< ::boost::detail::uxint_t
+ >::digits >;
+#endif
+
 
 // From <boost/integer/static_log2.hpp> ------------------------------------//
 

Modified: trunk/libs/integer/test/integer_mask_test.cpp
==============================================================================
--- trunk/libs/integer/test/integer_mask_test.cpp (original)
+++ trunk/libs/integer/test/integer_mask_test.cpp 2008-07-27 13:08:51 EDT (Sun, 27 Jul 2008)
@@ -8,7 +8,8 @@
 // See http://www.boost.org for most recent version including documentation.
 
 // Revision History
-// 27 Jul 2008 Changed tests to use the unit-test system (Daryle Walker)
+// 27 Jul 2008 Changed tests to use the unit-test system; added
+// extended-integer support. (Daryle Walker)
 // 23 Sep 2001 Initial version (Daryle Walker)
 
 #define BOOST_TEST_MODULE "Integer mask tests"
@@ -16,6 +17,7 @@
 
 #include <boost/cstdint.hpp> // for boost::uintmax_t
 #include <boost/integer/integer_mask.hpp> // for boost::high_bit_mask_t, etc.
+#include <boost/limits.hpp> // for std::numeric_limits
 #include <boost/mpl/assert.hpp> // for BOOST_MPL_ASSERT_RELATION
 #include <boost/mpl/range_c.hpp> // for boost::mpl::range_c
 
@@ -30,8 +32,10 @@
 boost::uintmax_t const one = 1u;
 
 // List the ranges of template parameters tests (ranges are half-open)
-typedef boost::mpl::range_c<std::size_t, 0u, 32u> high_bit_offsets;
-typedef boost::mpl::range_c<std::size_t, 1u, 33u> low_bit_lengths;
+int const max_offset = std::numeric_limits<boost::uintmax_t>::digits;
+
+typedef boost::mpl::range_c<std::size_t, 0, max_offset> high_bit_offsets;
+typedef boost::mpl::range_c<std::size_t, 1, max_offset + 1> low_bit_lengths;
 
 } // unnamed namespace
 


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