Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79804 - sandbox/big_number/boost/multiprecision
From: john_at_[hidden]
Date: 2012-07-30 13:51:48


Author: johnmaddock
Date: 2012-07-30 13:51:47 EDT (Mon, 30 Jul 2012)
New Revision: 79804
URL: http://svn.boost.org/trac/boost/changeset/79804

Log:
Fix misc bugs introduced in last commit.
Text files modified:
   sandbox/big_number/boost/multiprecision/cpp_int.hpp | 7 ++++++-
   1 files changed, 6 insertions(+), 1 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-07-30 13:51:47 EDT (Mon, 30 Jul 2012)
@@ -1326,6 +1326,7 @@
          result.limbs()[x] = static_cast<limb_type>(carry);
    }
    result.normalize();
+ result.sign(a.sign());
 }
 template <unsigned MinBits, bool Signed, class Allocator>
 inline void eval_add(cpp_int_backend<MinBits, Signed, Allocator, false>& result, const limb_type& o) BOOST_NOEXCEPT_IF(boost::is_void<Allocator>::value)
@@ -1400,7 +1401,9 @@
 inline void eval_subtract(cpp_int_backend<MinBits, Signed, Allocator, false>& result, const limb_type& o) BOOST_NOEXCEPT_IF(boost::is_void<Allocator>::value)
 {
    if(result.sign())
+ {
       add_unsigned(result, result, o);
+ }
    else
       subtract_unsigned(result, o);
 }
@@ -1408,7 +1411,9 @@
 inline void eval_subtract(cpp_int_backend<MinBits, Signed, Allocator, false>& result, const cpp_int_backend<MinBits, Signed, Allocator, false>& a, const limb_type& o) BOOST_NOEXCEPT_IF(boost::is_void<Allocator>::value)
 {
    if(a.sign())
+ {
       add_unsigned(result, a, o);
+ }
    else
    {
       result = a;
@@ -2068,8 +2073,8 @@
          *result = *pr / y;
          result->sign(x.sign());
       }
- r.sign(x.sign());
       *pr %= y;
+ r.sign(x.sign());
       return;
    }
    else if(r_order == 1)


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