Maybe this is more correct. realops likes it.
authorDavid Gow <[email protected]>
Sun, 6 Jul 2014 14:31:09 +0000 (22:31 +0800)
committerDavid Gow <[email protected]>
Sun, 6 Jul 2014 14:31:09 +0000 (22:31 +0800)
src/arbint.cpp

index 696dcd0..582d99a 100644 (file)
@@ -203,7 +203,10 @@ Arbint & Arbint::SubBasic(const Arbint & sub)
        {
                m_sign = !m_sign;
                for (unsigned i = 0; i < m_digits.size(); ++i)
-                       m_digits[i] = (~m_digits[i]) + 1;
+                       m_digits[i] = (~m_digits[i]);
+               std::vector<digit_t> one_digits(m_digits.size(), 0L);
+               one_digits[0] = 1;
+               add_digits((digit_t*)m_digits.data(), (digit_t*)one_digits.data(), m_digits.size());
        }
        return *this;
 }

UCC git Repository :: git.ucc.asn.au