|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77180 - in sandbox/big_number/boost/multiprecision: . detail
From: john_at_[hidden]
Date: 2012-03-03 13:39:38
Author: johnmaddock
Date: 2012-03-03 13:39:37 EST (Sat, 03 Mar 2012)
New Revision: 77180
URL: http://svn.boost.org/trac/boost/changeset/77180
Log:
Begin refactoring cpp_int code.
Added:
sandbox/big_number/boost/multiprecision/detail/cpp_int_core.hpp (contents, props changed)
Text files modified:
sandbox/big_number/boost/multiprecision/cpp_int.hpp | 33 +--------------------------------
sandbox/big_number/boost/multiprecision/fixed_int.hpp | 16 +---------------
2 files changed, 2 insertions(+), 47 deletions(-)
Modified: sandbox/big_number/boost/multiprecision/cpp_int.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/cpp_int.hpp (original)
+++ sandbox/big_number/boost/multiprecision/cpp_int.hpp 2012-03-03 13:39:37 EST (Sat, 03 Mar 2012)
@@ -13,43 +13,12 @@
#include <boost/array.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_floating_point.hpp>
-#include <boost/multiprecision/fixed_int.hpp>
+#include <boost/multiprecision/detail/cpp_int_core.hpp>
#include <boost/multiprecision/rational_adapter.hpp>
namespace boost{
namespace multiprecision{
- /*
-typedef boost::uint32_t limb_type;
-typedef boost::int32_t signed_limb_type;
-typedef boost::uint64_t double_limb_type;
-typedef boost::int64_t signed_double_limb_type;
-static const limb_type max_block_10 = 1000000000;
-static const limb_type digits_per_block_10 = 9;
-
-inline limb_type block_multiplier(int count)
-{
- static const limb_type values[digits_per_block_10]
- = { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 };
- BOOST_ASSERT(count < digits_per_block_10);
- return values[count];
-}
-*/
-template <class T>
-inline void minmax(const T& a, const T& b, T& aa, T& bb)
-{
- if(a < b)
- {
- aa = a;
- bb = b;
- }
- else
- {
- aa = b;
- bb = a;
- }
-}
-
template <unsigned InternalLimbs = 0, class Allocator = std::allocator<limb_type> >
struct cpp_int_backend : private Allocator::template rebind<limb_type>::other
{
Added: sandbox/big_number/boost/multiprecision/detail/cpp_int_core.hpp
==============================================================================
--- (empty file)
+++ sandbox/big_number/boost/multiprecision/detail/cpp_int_core.hpp 2012-03-03 13:39:37 EST (Sat, 03 Mar 2012)
@@ -0,0 +1,44 @@
+///////////////////////////////////////////////////////////////
+// Copyright 2012 John Maddock. 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_
+
+#ifndef BOOST_MP_CPP_INT_CORE_HPP
+#define BOOST_MP_CPP_INT_CORE_HPP
+
+namespace boost{ namespace multiprecision{
+
+typedef boost::uint32_t limb_type;
+typedef boost::int32_t signed_limb_type;
+typedef boost::uint64_t double_limb_type;
+typedef boost::int64_t signed_double_limb_type;
+static const limb_type max_block_10 = 1000000000;
+static const limb_type digits_per_block_10 = 9;
+
+inline limb_type block_multiplier(unsigned count)
+{
+ static const limb_type values[digits_per_block_10]
+ = { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 };
+ BOOST_ASSERT(count < digits_per_block_10);
+ return values[count];
+}
+
+template <class T>
+inline void minmax(const T& a, const T& b, T& aa, T& bb)
+{
+ if(a < b)
+ {
+ aa = a;
+ bb = b;
+ }
+ else
+ {
+ aa = b;
+ bb = a;
+ }
+}
+
+}}
+
+#endif // BOOST_MP_CPP_INT_CORE_HPP
+
Modified: sandbox/big_number/boost/multiprecision/fixed_int.hpp
==============================================================================
--- sandbox/big_number/boost/multiprecision/fixed_int.hpp (original)
+++ sandbox/big_number/boost/multiprecision/fixed_int.hpp 2012-03-03 13:39:37 EST (Sat, 03 Mar 2012)
@@ -10,6 +10,7 @@
#include <iomanip>
#include <boost/cstdint.hpp>
#include <boost/multiprecision/mp_number.hpp>
+#include <boost/multiprecision/detail/cpp_int_core.hpp>
#include <boost/array.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_floating_point.hpp>
@@ -17,21 +18,6 @@
namespace boost{
namespace multiprecision{
-typedef boost::uint32_t limb_type;
-typedef boost::int32_t signed_limb_type;
-typedef boost::uint64_t double_limb_type;
-typedef boost::int64_t signed_double_limb_type;
-static const limb_type max_block_10 = 1000000000;
-static const limb_type digits_per_block_10 = 9;
-
-inline limb_type block_multiplier(unsigned count)
-{
- static const limb_type values[digits_per_block_10]
- = { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 };
- BOOST_ASSERT(count < digits_per_block_10);
- return values[count];
-}
-
template <unsigned Bits, bool Signed>
struct fixed_int
{
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