|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77359 - in sandbox/big_number: boost/multiprecision libs/multiprecision/doc/html libs/multiprecision/example
From: john_at_[hidden]
Date: 2012-03-17 09:23:32
Author: johnmaddock
Date: 2012-03-17 09:23:32 EDT (Sat, 17 Mar 2012)
New Revision: 77359
URL: http://svn.boost.org/trac/boost/changeset/77359
Log:
Fix bug in cpp_int shown up by random number generations and change example to use it.
Text files modified:
sandbox/big_number/boost/multiprecision/cpp_int.hpp | 6 ++++--
sandbox/big_number/libs/multiprecision/doc/html/index.html | 2 +-
sandbox/big_number/libs/multiprecision/example/safe_prime.cpp | 4 ++--
3 files changed, 7 insertions(+), 5 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-17 09:23:32 EDT (Sat, 17 Mar 2012)
@@ -745,7 +745,9 @@
// Nothing fancy, just let uintmax_t take the strain:
double_limb_type carry = 0;
unsigned m, x;
- minmax(a.size(), b.size(), m, x);
+ unsigned as = a.size();
+ unsigned bs = b.size();
+ minmax(as, bs, m, x);
if(x == 1)
{
bool s = a.sign();
@@ -759,7 +761,7 @@
typename cpp_int_backend<MinBits, Signed, Allocator>::limb_pointer pr = result.limbs();
typename cpp_int_backend<MinBits, Signed, Allocator>::limb_pointer pr_end = pr + m;
- if(a.size() < b.size())
+ if(as < bs)
swap(pa, pb);
// First where a and b overlap:
Modified: sandbox/big_number/libs/multiprecision/doc/html/index.html
==============================================================================
--- sandbox/big_number/libs/multiprecision/doc/html/index.html (original)
+++ sandbox/big_number/libs/multiprecision/doc/html/index.html 2012-03-17 09:23:32 EDT (Sat, 17 Mar 2012)
@@ -58,7 +58,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: March 17, 2012 at 09:04:10 GMT</small></p></td>
+<td align="left"><p><small>Last revised: March 17, 2012 at 13:19:03 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: sandbox/big_number/libs/multiprecision/example/safe_prime.cpp
==============================================================================
--- sandbox/big_number/libs/multiprecision/example/safe_prime.cpp (original)
+++ sandbox/big_number/libs/multiprecision/example/safe_prime.cpp 2012-03-17 09:23:32 EDT (Sat, 17 Mar 2012)
@@ -5,7 +5,7 @@
//[safe_prime
-#include <boost/multiprecision/gmp.hpp>
+#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/miller_rabin.hpp>
#include <iostream>
#include <iomanip>
@@ -15,7 +15,7 @@
using namespace boost::random;
using namespace boost::multiprecision;
- typedef mpz_int int_type;
+ typedef cpp_int int_type;
mt11213b base_gen(clock());
independent_bits_engine<mt11213b, 256, int_type> gen(base_gen);
//
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