diff --git a/include/boost/multiprecision/cpp_int.hpp b/include/boost/multiprecision/cpp_int.hpp index de26540f..a9ebeac7 100644 --- a/include/boost/multiprecision/cpp_int.hpp +++ b/include/boost/multiprecision/cpp_int.hpp @@ -1511,7 +1511,8 @@ void divide_unsigned_helper(cpp_int_backend* result, { result->resize(r_order + 1); pres = result->limbs(); - pres[r_order] = 0; // just in case we don't set the most significant limb below. + if(result->size() > r_order) + pres[r_order] = 0; // just in case we don't set the most significant limb below. } do diff --git a/include/boost/multiprecision/tommath.hpp b/include/boost/multiprecision/tommath.hpp index cc32fcd9..5f2c3db6 100644 --- a/include/boost/multiprecision/tommath.hpp +++ b/include/boost/multiprecision/tommath.hpp @@ -200,7 +200,7 @@ struct tommath_int unsigned shift = radix == 8 ? 3 : 4; unsigned block_count = DIGIT_BIT / shift; unsigned block_shift = shift * block_count; - boost::uint32_t val, block; + unsigned long long val, block; while(*s) { block = 0; diff --git a/performance/miller_rabin_performance.cpp b/performance/miller_rabin_performance.cpp index 458c14b2..9667aa51 100644 --- a/performance/miller_rabin_performance.cpp +++ b/performance/miller_rabin_performance.cpp @@ -138,7 +138,7 @@ int main() #ifdef TEST_CPP_INT test_miller_rabin, false> >("cpp_int (no Expression templates)"); test_miller_rabin("cpp_int"); - test_miller_rabin > >("cpp_int (64-bit cache)"); + test_miller_rabin > >("cpp_int (128-bit cache)"); test_miller_rabin > >("cpp_int (256-bit cache)"); test_miller_rabin > >("cpp_int (512-bit cache)"); test_miller_rabin > >("cpp_int (1024-bit cache)");