diff --git a/include/boost/multiprecision/cpp_int.hpp b/include/boost/multiprecision/cpp_int.hpp index ca80fd2f..d50bf068 100644 --- a/include/boost/multiprecision/cpp_int.hpp +++ b/include/boost/multiprecision/cpp_int.hpp @@ -71,14 +71,14 @@ public: // // Helper functions for getting at our internal data, and manipulating storage: // - allocator_type& allocator(){ return *this; } - const allocator_type& allocator()const{ return *this; } - unsigned size()const { return m_limbs; } - limb_pointer limbs() { return m_internal ? m_data.la : m_data.ld.data; } - const_limb_pointer limbs()const { return m_internal ? m_data.la : m_data.ld.data; } - unsigned capacity()const { return m_internal ? internal_limb_count : m_data.ld.capacity; } - bool sign()const { return m_sign; } - void sign(bool b) + allocator_type& allocator() BOOST_NOEXCEPT { return *this; } + const allocator_type& allocator()const BOOST_NOEXCEPT { return *this; } + unsigned size()const BOOST_NOEXCEPT { return m_limbs; } + limb_pointer limbs() BOOST_NOEXCEPT { return m_internal ? m_data.la : m_data.ld.data; } + const_limb_pointer limbs()const BOOST_NOEXCEPT { return m_internal ? m_data.la : m_data.ld.data; } + unsigned capacity()const BOOST_NOEXCEPT { return m_internal ? internal_limb_count : m_data.ld.capacity; } + bool sign()const BOOST_NOEXCEPT { return m_sign; } + void sign(bool b) BOOST_NOEXCEPT { m_sign = b; // Check for zero value: @@ -109,15 +109,14 @@ public: m_limbs = new_size; } } - void normalize() + void normalize() BOOST_NOEXCEPT { limb_pointer p = limbs(); while((m_limbs-1) && !p[m_limbs - 1])--m_limbs; } - cpp_int_base() : m_limbs(1), m_sign(false), m_internal(true) + BOOST_CONSTEXPR cpp_int_base() BOOST_NOEXCEPT : m_data(), m_limbs(1), m_sign(false), m_internal(true) { - *limbs() = 0; } cpp_int_base(const cpp_int_base& o) : allocator_type(o), m_limbs(0), m_internal(true) { @@ -126,7 +125,7 @@ public: m_sign = o.m_sign; } #ifndef BOOST_NO_RVALUE_REFERENCES - cpp_int_base(cpp_int_base&& o) : allocator_type(o), m_limbs(o.m_limbs), m_sign(o.m_sign), m_internal(o.m_internal) + cpp_int_base(cpp_int_base&& o) BOOST_NOEXCEPT : allocator_type(o), m_limbs(o.m_limbs), m_sign(o.m_sign), m_internal(o.m_internal) { if(m_internal) { @@ -140,7 +139,7 @@ public: } } #endif - ~cpp_int_base() + ~cpp_int_base() BOOST_NOEXCEPT { if(!m_internal) allocator().deallocate(limbs(), capacity()); @@ -156,7 +155,7 @@ public: m_sign = o.m_sign; } } - void negate() + void negate() BOOST_NOEXCEPT { m_sign = !m_sign; // Check for zero value: @@ -166,11 +165,11 @@ public: m_sign = false; } } - bool isneg()const + bool isneg()const BOOST_NOEXCEPT { return m_sign; } - void do_swap(cpp_int_base& o) + void do_swap(cpp_int_base& o) BOOST_NOEXCEPT { std::swap(m_data, o.m_data); std::swap(m_sign, o.m_sign); @@ -203,11 +202,11 @@ public: // // Helper functions for getting at our internal data, and manipulating storage: // - unsigned size()const { return m_limbs; } - limb_pointer limbs() { return m_data; } - const_limb_pointer limbs()const { return m_data; } - bool sign()const { return m_sign; } - void sign(bool b) + unsigned size()const BOOST_NOEXCEPT { return m_limbs; } + limb_pointer limbs() BOOST_NOEXCEPT { return m_data; } + const_limb_pointer limbs()const BOOST_NOEXCEPT { return m_data; } + bool sign()const BOOST_NOEXCEPT { return m_sign; } + void sign(bool b) BOOST_NOEXCEPT { m_sign = b; // Check for zero value: @@ -217,11 +216,11 @@ public: m_sign = false; } } - void resize(unsigned new_size) + void resize(unsigned new_size) BOOST_NOEXCEPT { m_limbs = static_cast((std::min)(new_size, internal_limb_count)); } - void normalize() + void normalize() BOOST_NOEXCEPT { limb_pointer p = limbs(); p[internal_limb_count-1] &= upper_limb_mask; @@ -229,24 +228,21 @@ public: if((m_limbs == 1) && (!*p)) m_sign = false; // zero is always unsigned } - cpp_int_base() : m_limbs(1), m_sign(false) - { - *limbs() = 0; - } - cpp_int_base(const cpp_int_base& o) : m_limbs(0) + BOOST_CONSTEXPR cpp_int_base() : m_data(), m_limbs(1), m_sign(false) {} + cpp_int_base(const cpp_int_base& o) BOOST_NOEXCEPT : m_limbs(0) { resize(o.size()); std::memcpy(limbs(), o.limbs(), size() * sizeof(limb_type)); m_sign = o.m_sign; } #ifndef BOOST_NO_RVALUE_REFERENCES - cpp_int_base(cpp_int_base&& o) : m_limbs(o.m_limbs), m_sign(o.m_sign) + cpp_int_base(cpp_int_base&& o) BOOST_NOEXCEPT : m_limbs(o.m_limbs), m_sign(o.m_sign) { std::memcpy(limbs(), o.limbs(), size() * sizeof(limb_type)); } #endif - ~cpp_int_base() {} - void assign(const cpp_int_base& o) + ~cpp_int_base() BOOST_NOEXCEPT {} + void assign(const cpp_int_base& o) BOOST_NOEXCEPT { if(this != &o) { @@ -255,7 +251,7 @@ public: m_sign = o.m_sign; } } - void negate() + void negate() BOOST_NOEXCEPT { m_sign = !m_sign; // Check for zero value: @@ -265,11 +261,11 @@ public: m_sign = false; } } - bool isneg()const + bool isneg()const BOOST_NOEXCEPT { return m_sign; } - void do_swap(cpp_int_base& o) + void do_swap(cpp_int_base& o) BOOST_NOEXCEPT { for(unsigned i = 0; i < (std::max)(size(), o.size()); ++i) std::swap(m_data[i], o.m_data[i]); @@ -301,39 +297,36 @@ public: // // Helper functions for getting at our internal data, and manipulating storage: // - unsigned size()const { return m_limbs; } - limb_pointer limbs() { return m_data; } - const_limb_pointer limbs()const { return m_data; } - bool sign()const { return false; } - void sign(bool b) { if(b) negate(); } - void resize(unsigned new_size) + unsigned size()const BOOST_NOEXCEPT { return m_limbs; } + limb_pointer limbs() BOOST_NOEXCEPT { return m_data; } + const_limb_pointer limbs()const BOOST_NOEXCEPT { return m_data; } + BOOST_CONSTEXPR bool sign()const BOOST_NOEXCEPT { return false; } + void sign(bool b) BOOST_NOEXCEPT { if(b) negate(); } + void resize(unsigned new_size) BOOST_NOEXCEPT { m_limbs = (std::min)(new_size, internal_limb_count); } - void normalize() + void normalize() BOOST_NOEXCEPT { limb_pointer p = limbs(); p[internal_limb_count-1] &= upper_limb_mask; while((m_limbs-1) && !p[m_limbs - 1])--m_limbs; } - cpp_int_base() : m_limbs(1) - { - *limbs() = 0; - } - cpp_int_base(const cpp_int_base& o) : m_limbs(0) + BOOST_CONSTEXPR cpp_int_base() BOOST_NOEXCEPT : m_data(), m_limbs(1) {} + cpp_int_base(const cpp_int_base& o) BOOST_NOEXCEPT : m_limbs(0) { resize(o.size()); std::memcpy(limbs(), o.limbs(), size() * sizeof(limb_type)); } #ifndef BOOST_NO_RVALUE_REFERENCES - cpp_int_base(cpp_int_base&& o) : m_limbs(o.m_limbs) + cpp_int_base(cpp_int_base&& o) BOOST_NOEXCEPT : m_limbs(o.m_limbs) { std::memcpy(limbs(), o.limbs(), size() * sizeof(limb_type)); } #endif - ~cpp_int_base() {} - void assign(const cpp_int_base& o) + ~cpp_int_base() BOOST_NOEXCEPT {} + void assign(const cpp_int_base& o) BOOST_NOEXCEPT { if(this != &o) { @@ -341,7 +334,7 @@ public: std::memcpy(limbs(), o.limbs(), size() * sizeof(limb_type)); } } - void negate() + void negate() BOOST_NOEXCEPT { // Not so much a negate as a complement - this gets called when subtraction // would result in a "negative" number: @@ -354,11 +347,11 @@ public: normalize(); eval_increment(static_cast& >(*this)); } - bool isneg()const + BOOST_CONSTEXPR bool isneg()const BOOST_NOEXCEPT { return false; } - void do_swap(cpp_int_base& o) + void do_swap(cpp_int_base& o) BOOST_NOEXCEPT { for(unsigned i = 0; i < (std::max)(size(), o.size()); ++i) std::swap(m_data[i], o.m_data[i]); @@ -408,31 +401,31 @@ public: typedef mpl::list unsigned_types; typedef mpl::list float_types; - cpp_int_backend(){} - cpp_int_backend(const cpp_int_backend& o) : base_type(o) {} + BOOST_CONSTEXPR cpp_int_backend() BOOST_NOEXCEPT{} + cpp_int_backend(const cpp_int_backend& o) BOOST_NOEXCEPT_IF(boost::is_void::value) : base_type(o) {} #ifndef BOOST_NO_RVALUE_REFERENCES - cpp_int_backend(cpp_int_backend&& o) : base_type(static_cast(o)) {} + cpp_int_backend(cpp_int_backend&& o) BOOST_NOEXCEPT : base_type(static_cast(o)) {} #endif - cpp_int_backend& operator = (const cpp_int_backend& o) + cpp_int_backend& operator = (const cpp_int_backend& o) BOOST_NOEXCEPT_IF(boost::is_void::value) { this->assign(o); return *this; } - cpp_int_backend& operator = (limb_type i) + cpp_int_backend& operator = (limb_type i) BOOST_NOEXCEPT { this->resize(1); *this->limbs() = i; this->sign(false); return *this; } - cpp_int_backend& operator = (signed_limb_type i) + cpp_int_backend& operator = (signed_limb_type i) BOOST_NOEXCEPT { this->resize(1); *this->limbs() = static_cast(std::abs(i)); this->sign(i < 0); return *this; } - cpp_int_backend& operator = (double_limb_type i) + cpp_int_backend& operator = (double_limb_type i) BOOST_NOEXCEPT_IF(MinBits <= sizeof(double_limb_type) * CHAR_BIT) { BOOST_STATIC_ASSERT(sizeof(i) == 2 * sizeof(limb_type)); BOOST_STATIC_ASSERT(base_type::internal_limb_count >= 2); @@ -443,7 +436,7 @@ public: this->sign(false); return *this; } - cpp_int_backend& operator = (signed_double_limb_type i) + cpp_int_backend& operator = (signed_double_limb_type i) BOOST_NOEXCEPT_IF(MinBits <= sizeof(signed_double_limb_type) * CHAR_BIT) { BOOST_STATIC_ASSERT(sizeof(i) == 2 * sizeof(limb_type)); BOOST_STATIC_ASSERT(base_type::internal_limb_count >= 2); @@ -463,7 +456,7 @@ public: return *this; } - cpp_int_backend& operator = (long double a) + cpp_int_backend& operator = (long double a) BOOST_NOEXCEPT_IF(MinBits <= sizeof(long double) * CHAR_BIT) { using default_ops::eval_add; using default_ops::eval_subtract; @@ -607,7 +600,7 @@ public: this->negate(); return *this; } - void swap(cpp_int_backend& o) + void swap(cpp_int_backend& o) BOOST_NOEXCEPT { this->do_swap(o); } @@ -707,7 +700,7 @@ public: } return result; } - int compare(const cpp_int_backend& o)const + int compare(const cpp_int_backend& o)const BOOST_NOEXCEPT { if(this->sign() != o.sign()) return this->sign() ? -1 : 1; @@ -719,7 +712,7 @@ public: result = -result; return result; } - int compare_unsigned(const cpp_int_backend& o)const + int compare_unsigned(const cpp_int_backend& o)const BOOST_NOEXCEPT { if(this->size() != o.size()) { @@ -735,7 +728,7 @@ public: return 0; } template - typename enable_if, int>::type compare(Arithmatic i)const + typename enable_if, int>::type compare(Arithmatic i)const BOOST_NOEXCEPT { // braindead version: cpp_int_backend t; @@ -746,12 +739,12 @@ public: template -inline void eval_add(cpp_int_backend& result, const cpp_int_backend& o) +inline void eval_add(cpp_int_backend& result, const cpp_int_backend& o) BOOST_NOEXCEPT_IF(boost::is_void::value) { eval_add(result, result, o); } template -inline void add_unsigned(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) +inline void add_unsigned(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) BOOST_NOEXCEPT_IF(boost::is_void::value) { using std::swap; @@ -811,7 +804,7 @@ inline void add_unsigned(cpp_int_backend& result, co result.sign(a.sign()); } template -inline void eval_add(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) +inline void eval_add(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) BOOST_NOEXCEPT_IF(boost::is_void::value) { if(a.sign() != b.sign()) { @@ -822,7 +815,7 @@ inline void eval_add(cpp_int_backend& result, const } template -inline void add_unsigned(cpp_int_backend& result, const limb_type& o) +inline void add_unsigned(cpp_int_backend& result, const limb_type& o) BOOST_NOEXCEPT_IF(boost::is_void::value) { // Addition using modular arithmatic. // Nothing fancy, just let uintmax_t take the strain: @@ -845,7 +838,7 @@ inline void add_unsigned(cpp_int_backend& result, co result.normalize(); } template -inline void eval_add(cpp_int_backend& result, const limb_type& o) +inline void eval_add(cpp_int_backend& result, const limb_type& o) BOOST_NOEXCEPT_IF(boost::is_void::value) { if(result.sign()) { @@ -855,7 +848,7 @@ inline void eval_add(cpp_int_backend& result, const add_unsigned(result, o); } template -inline void eval_add(cpp_int_backend& result, const signed_limb_type& o) +inline void eval_add(cpp_int_backend& result, const signed_limb_type& o) BOOST_NOEXCEPT_IF(boost::is_void::value) { if(o < 0) eval_subtract(result, static_cast(-o)); @@ -864,7 +857,7 @@ inline void eval_add(cpp_int_backend& result, const } template -inline void subtract_unsigned(cpp_int_backend& result, const limb_type& o) +inline void subtract_unsigned(cpp_int_backend& result, const limb_type& o) BOOST_NOEXCEPT_IF(boost::is_void::value) { // Subtract one limb. // Nothing fancy, just let uintmax_t take the strain: @@ -893,7 +886,7 @@ inline void subtract_unsigned(cpp_int_backend& resul } } template -inline void eval_subtract(cpp_int_backend& result, const limb_type& o) +inline void eval_subtract(cpp_int_backend& result, const limb_type& o) BOOST_NOEXCEPT_IF(boost::is_void::value) { if(result.sign()) add_unsigned(result, o); @@ -901,7 +894,7 @@ inline void eval_subtract(cpp_int_backend& result, c subtract_unsigned(result, o); } template -inline void eval_subtract(cpp_int_backend& result, const signed_limb_type& o) +inline void eval_subtract(cpp_int_backend& result, const signed_limb_type& o) BOOST_NOEXCEPT_IF(boost::is_void::value) { if(o) { @@ -912,7 +905,7 @@ inline void eval_subtract(cpp_int_backend& result, c } } template -inline void eval_increment(cpp_int_backend& result) +inline void eval_increment(cpp_int_backend& result) BOOST_NOEXCEPT_IF(boost::is_void::value) { static const limb_type one = 1; if(!result.sign() && (result.limbs()[0] < cpp_int_backend::max_limb_value)) @@ -923,7 +916,7 @@ inline void eval_increment(cpp_int_backend& result) eval_add(result, one); } template -inline void eval_decrement(cpp_int_backend& result) +inline void eval_decrement(cpp_int_backend& result) BOOST_NOEXCEPT_IF(boost::is_void::value) { static const limb_type one = 1; if(!result.sign() && result.limbs()[0]) @@ -934,12 +927,12 @@ inline void eval_decrement(cpp_int_backend& result) eval_subtract(result, one); } template -inline void eval_subtract(cpp_int_backend& result, const cpp_int_backend& o) +inline void eval_subtract(cpp_int_backend& result, const cpp_int_backend& o) BOOST_NOEXCEPT_IF(boost::is_void::value) { eval_subtract(result, result, o); } template -inline void subtract_unsigned(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) +inline void subtract_unsigned(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) BOOST_NOEXCEPT_IF(boost::is_void::value) { using std::swap; @@ -1016,7 +1009,7 @@ inline void subtract_unsigned(cpp_int_backend& resul result.negate(); } template -inline void eval_subtract(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) +inline void eval_subtract(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) BOOST_NOEXCEPT_IF(boost::is_void::value) { if(a.sign() != b.sign()) { @@ -1026,7 +1019,7 @@ inline void eval_subtract(cpp_int_backend& result, c subtract_unsigned(result, a, b); } template -inline void eval_multiply(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) +inline void eval_multiply(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) BOOST_NOEXCEPT_IF(boost::is_void::value) { // Very simple long multiplication, only usable for small numbers of limb_type's // but that's the typical use case for this type anyway: @@ -1106,12 +1099,12 @@ inline void eval_multiply(cpp_int_backend& result, c result.sign(a.sign() != b.sign()); } template -inline void eval_multiply(cpp_int_backend& result, const cpp_int_backend& a) +inline void eval_multiply(cpp_int_backend& result, const cpp_int_backend& a) BOOST_NOEXCEPT_IF(boost::is_void::value) { eval_multiply(result, result, a); } template -inline void eval_multiply(cpp_int_backend& result, cpp_int_backend& a, const limb_type& val) +inline void eval_multiply(cpp_int_backend& result, cpp_int_backend& a, const limb_type& val) BOOST_NOEXCEPT_IF(boost::is_void::value) { if(!val) { @@ -1140,12 +1133,12 @@ inline void eval_multiply(cpp_int_backend& result, c result.normalize(); } template -inline void eval_multiply(cpp_int_backend& result, const limb_type& val) +inline void eval_multiply(cpp_int_backend& result, const limb_type& val) BOOST_NOEXCEPT_IF(boost::is_void::value) { eval_multiply(result, result, val); } template -inline void eval_multiply(cpp_int_backend& result, cpp_int_backend& a, const signed_limb_type& val) +inline void eval_multiply(cpp_int_backend& result, cpp_int_backend& a, const signed_limb_type& val) BOOST_NOEXCEPT_IF(boost::is_void::value) { if(val > 0) eval_multiply(result, a, static_cast(val)); @@ -1156,12 +1149,12 @@ inline void eval_multiply(cpp_int_backend& result, c } } template -inline void eval_multiply(cpp_int_backend& result, const signed_limb_type& val) +inline void eval_multiply(cpp_int_backend& result, const signed_limb_type& val) BOOST_NOEXCEPT_IF(boost::is_void::value) { eval_multiply(result, result, val); } template -void divide_unsigned_helper(cpp_int_backend* result, const cpp_int_backend& x, const cpp_int_backend& y, cpp_int_backend& r) +void divide_unsigned_helper(cpp_int_backend* result, const cpp_int_backend& x, const cpp_int_backend& y, cpp_int_backend& r) BOOST_NOEXCEPT_IF(boost::is_void::value) { if((result == &x) || (&r == &x)) { @@ -1428,7 +1421,7 @@ void divide_unsigned_helper(cpp_int_backend* result, } template -void divide_unsigned_helper(cpp_int_backend* result, const cpp_int_backend& x, limb_type y, cpp_int_backend& r) +void divide_unsigned_helper(cpp_int_backend* result, const cpp_int_backend& x, limb_type y, cpp_int_backend& r) BOOST_NOEXCEPT_IF(boost::is_void::value) { if((result == &x) || (&r == &x)) { @@ -1571,20 +1564,20 @@ void divide_unsigned_helper(cpp_int_backend* result, } template -inline void eval_divide(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) +inline void eval_divide(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) BOOST_NOEXCEPT_IF(boost::is_void::value) { cpp_int_backend r; divide_unsigned_helper(&result, a, b, r); result.sign(a.sign() != b.sign()); } template -inline void eval_divide(cpp_int_backend& result, const cpp_int_backend& a, limb_type& b) +inline void eval_divide(cpp_int_backend& result, const cpp_int_backend& a, limb_type& b) BOOST_NOEXCEPT_IF(boost::is_void::value) { cpp_int_backend r; divide_unsigned_helper(&result, a, b, r); } template -inline void eval_divide(cpp_int_backend& result, const cpp_int_backend& a, signed_limb_type& b) +inline void eval_divide(cpp_int_backend& result, const cpp_int_backend& a, signed_limb_type& b) BOOST_NOEXCEPT_IF(boost::is_void::value) { cpp_int_backend r; divide_unsigned_helper(&result, a, std::abs(b), r); @@ -1592,65 +1585,65 @@ inline void eval_divide(cpp_int_backend& result, con result.negate(); } template -inline void eval_divide(cpp_int_backend& result, const cpp_int_backend& b) +inline void eval_divide(cpp_int_backend& result, const cpp_int_backend& b) BOOST_NOEXCEPT_IF(boost::is_void::value) { // There is no in place divide: cpp_int_backend a(result); eval_divide(result, a, b); } template -inline void eval_divide(cpp_int_backend& result, limb_type b) +inline void eval_divide(cpp_int_backend& result, limb_type b) BOOST_NOEXCEPT_IF(boost::is_void::value) { // There is no in place divide: cpp_int_backend a(result); eval_divide(result, a, b); } template -inline void eval_divide(cpp_int_backend& result, signed_limb_type b) +inline void eval_divide(cpp_int_backend& result, signed_limb_type b) BOOST_NOEXCEPT_IF(boost::is_void::value) { // There is no in place divide: cpp_int_backend a(result); eval_divide(result, a, b); } template -inline void eval_modulus(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) +inline void eval_modulus(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) BOOST_NOEXCEPT_IF(boost::is_void::value) { divide_unsigned_helper(static_cast* >(0), a, b, result); result.sign(a.sign()); } template -inline void eval_modulus(cpp_int_backend& result, const cpp_int_backend& a, limb_type b) +inline void eval_modulus(cpp_int_backend& result, const cpp_int_backend& a, limb_type b) BOOST_NOEXCEPT_IF(boost::is_void::value) { divide_unsigned_helper(static_cast* >(0), a, b, result); } template -inline void eval_modulus(cpp_int_backend& result, const cpp_int_backend& a, signed_limb_type b) +inline void eval_modulus(cpp_int_backend& result, const cpp_int_backend& a, signed_limb_type b) BOOST_NOEXCEPT_IF(boost::is_void::value) { divide_unsigned_helper(static_cast* >(0), a, static_cast(std::abs(b)), result); } template -inline void eval_modulus(cpp_int_backend& result, const cpp_int_backend& b) +inline void eval_modulus(cpp_int_backend& result, const cpp_int_backend& b) BOOST_NOEXCEPT_IF(boost::is_void::value) { // There is no in place divide: cpp_int_backend a(result); eval_modulus(result, a, b); } template -inline void eval_modulus(cpp_int_backend& result, limb_type b) +inline void eval_modulus(cpp_int_backend& result, limb_type b) BOOST_NOEXCEPT_IF(boost::is_void::value) { // There is no in place divide: cpp_int_backend a(result); eval_modulus(result, a, b); } template -inline void eval_modulus(cpp_int_backend& result, signed_limb_type b) +inline void eval_modulus(cpp_int_backend& result, signed_limb_type b) BOOST_NOEXCEPT_IF(boost::is_void::value) { // There is no in place divide: cpp_int_backend a(result); eval_modulus(result, a, b); } template -void bitwise_op(cpp_int_backend& result, const cpp_int_backend& o, Op op) +void bitwise_op(cpp_int_backend& result, const cpp_int_backend& o, Op op) BOOST_NOEXCEPT { // // There are 4 cases: @@ -1775,70 +1768,27 @@ void bitwise_op(cpp_int_backend& result, const cpp_i result.normalize(); } -struct bit_and{ limb_type operator()(limb_type a, limb_type b)const{ return a & b; } }; -struct bit_or{ limb_type operator()(limb_type a, limb_type b)const{ return a | b; } }; -struct bit_xor{ limb_type operator()(limb_type a, limb_type b)const{ return a ^ b; } }; +struct bit_and{ limb_type operator()(limb_type a, limb_type b)const BOOST_NOEXCEPT { return a & b; } }; +struct bit_or { limb_type operator()(limb_type a, limb_type b)const BOOST_NOEXCEPT { return a | b; } }; +struct bit_xor{ limb_type operator()(limb_type a, limb_type b)const BOOST_NOEXCEPT { return a ^ b; } }; template -inline void eval_bitwise_and(cpp_int_backend& result, const cpp_int_backend& o) +inline void eval_bitwise_and(cpp_int_backend& result, const cpp_int_backend& o)BOOST_NOEXCEPT { bitwise_op(result, o, bit_and()); } -#if 0 template -inline void eval_bitwise_and(cpp_int_backend& result, limb_type o) -{ - result.data()[cpp_int_backend::limb_count - 1] &= o; - for(typename cpp_int_backend::data_type::size_type i = 0; i < cpp_int_backend::limb_count - 1; ++i) - result.data()[i] = 0; -} -template -inline void eval_bitwise_and(cpp_int_backend& result, signed_limb_type o) -{ - result.data()[cpp_int_backend::limb_count - 1] &= o; - limb_type mask = o < 0 ? cpp_int_backend::max_limb_value : 0; - for(typename cpp_int_backend::data_type::size_type i = 0; i < cpp_int_backend::limb_count - 1; ++i) - result.data()[i] &= mask; -} -template -inline void eval_bitwise_or(cpp_int_backend& result, const cpp_int_backend& o) -{ - for(typename cpp_int_backend::data_type::size_type i = 0; i < cpp_int_backend::limb_count; ++i) - result.data()[i] |= o.data()[i]; -} -template -inline void eval_bitwise_or(cpp_int_backend& result, limb_type o) -{ - result.data()[cpp_int_backend::limb_count - 1] |= o; -} -#endif -template -inline void eval_bitwise_or(cpp_int_backend& result, const cpp_int_backend& o) +inline void eval_bitwise_or(cpp_int_backend& result, const cpp_int_backend& o) BOOST_NOEXCEPT { bitwise_op(result, o, bit_or()); } template -inline void eval_bitwise_xor(cpp_int_backend& result, const cpp_int_backend& o) +inline void eval_bitwise_xor(cpp_int_backend& result, const cpp_int_backend& o) BOOST_NOEXCEPT { bitwise_op(result, o, bit_xor()); } -#if 0 template -inline void eval_bitwise_xor(cpp_int_backend& result, limb_type o) -{ - result.data()[cpp_int_backend::limb_count - 1] ^= o; -} -template -inline void eval_bitwise_xor(cpp_int_backend& result, signed_limb_type o) -{ - result.data()[cpp_int_backend::limb_count - 1] ^= o; - limb_type mask = o < 0 ? cpp_int_backend::max_limb_value : 0; - for(typename cpp_int_backend::data_type::size_type i = 0; i < cpp_int_backend::limb_count - 1; ++i) - result.data()[i] ^= mask; -} -#endif -template -inline void eval_complement(cpp_int_backend& result, const cpp_int_backend& o) +inline void eval_complement(cpp_int_backend& result, const cpp_int_backend& o) BOOST_NOEXCEPT_IF(boost::is_void::value) { // Increment and negate: result = o; @@ -1846,7 +1796,7 @@ inline void eval_complement(cpp_int_backend& result, result.negate(); } template -inline void eval_left_shift(cpp_int_backend& result, double_limb_type s) +inline void eval_left_shift(cpp_int_backend& result, double_limb_type s) BOOST_NOEXCEPT { if(!s) return; @@ -1922,7 +1872,7 @@ inline void eval_left_shift(cpp_int_backend& result, doub } } template -inline void eval_left_shift(cpp_int_backend& result, double_limb_type s) +inline void eval_left_shift(cpp_int_backend& result, double_limb_type s) BOOST_NOEXCEPT_IF(boost::is_void::value) { if(!s) return; @@ -1979,7 +1929,7 @@ inline void eval_left_shift(cpp_int_backend& result, } } template -inline void eval_right_shift(cpp_int_backend& result, double_limb_type s) +inline void eval_right_shift(cpp_int_backend& result, double_limb_type s) BOOST_NOEXCEPT_IF(boost::is_void::value) { if(!s) return; @@ -2022,18 +1972,18 @@ inline void eval_right_shift(cpp_int_backend& result } template -inline Integer negate_integer(Integer i, const mpl::true_&) +inline Integer negate_integer(Integer i, const mpl::true_&) BOOST_NOEXCEPT { return -i; } template -inline Integer negate_integer(Integer i, const mpl::false_&) +inline Integer negate_integer(Integer i, const mpl::false_&) BOOST_NOEXCEPT { return ~--i; } template -inline typename enable_if, void>::type eval_convert_to(R* result, const cpp_int_backend& backend) +inline typename enable_if, void>::type eval_convert_to(R* result, const cpp_int_backend& backend) BOOST_NOEXCEPT { *result = static_cast(backend.limbs()[0]); unsigned shift = cpp_int_backend::limb_bits; @@ -2049,7 +1999,7 @@ inline typename enable_if, void>::type eval_convert_to(R* result, } template -inline typename enable_if, void>::type eval_convert_to(R* result, const cpp_int_backend& backend) +inline typename enable_if, void>::type eval_convert_to(R* result, const cpp_int_backend& backend) BOOST_NOEXCEPT { typename cpp_int_backend::const_limb_pointer p = backend.limbs(); unsigned shift = cpp_int_backend::limb_bits; @@ -2064,17 +2014,17 @@ inline typename enable_if, void>::type eval_convert_to(R* r } template -inline bool eval_is_zero(const cpp_int_backend& val) +inline bool eval_is_zero(const cpp_int_backend& val) BOOST_NOEXCEPT { return (val.size() == 1) && (val.limbs()[0] == 0); } template -inline int eval_get_sign(const cpp_int_backend& val) +inline int eval_get_sign(const cpp_int_backend& val) BOOST_NOEXCEPT { return eval_is_zero(val) ? 0 : val.sign() ? -1 : 1; } template -inline void eval_abs(cpp_int_backend& result, const cpp_int_backend& val) +inline void eval_abs(cpp_int_backend& result, const cpp_int_backend& val) BOOST_NOEXCEPT_IF(boost::is_void::value) { result = val; result.sign(false); @@ -2084,7 +2034,7 @@ inline void eval_abs(cpp_int_backend& result, const // Get the location of the least-significant-bit: // template -inline unsigned eval_lsb(const cpp_int_backend& a) +inline unsigned eval_lsb(const cpp_int_backend& a) BOOST_NOEXCEPT { BOOST_ASSERT(eval_get_sign(a) != 0); @@ -2109,7 +2059,7 @@ inline unsigned eval_lsb(const cpp_int_backend& a) } template -inline void eval_gcd(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) +inline void eval_gcd(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) BOOST_NOEXCEPT_IF(boost::is_void::value) { int shift; @@ -2169,7 +2119,7 @@ inline void eval_gcd(cpp_int_backend& result, const } template -inline bool eval_bit_test(const cpp_int_backend& val, unsigned index) +inline bool eval_bit_test(const cpp_int_backend& val, unsigned index) BOOST_NOEXCEPT { unsigned offset = index / cpp_int_backend::limb_bits; unsigned shift = index % cpp_int_backend::limb_bits; @@ -2180,7 +2130,7 @@ inline bool eval_bit_test(const cpp_int_backend& val } template -inline void eval_bit_set(cpp_int_backend& val, unsigned index) +inline void eval_bit_set(cpp_int_backend& val, unsigned index) BOOST_NOEXCEPT_IF(boost::is_void::value) { unsigned offset = index / cpp_int_backend::limb_bits; unsigned shift = index % cpp_int_backend::limb_bits; @@ -2198,7 +2148,7 @@ inline void eval_bit_set(cpp_int_backend& val, unsig } template -inline void eval_bit_unset(cpp_int_backend& val, unsigned index) +inline void eval_bit_unset(cpp_int_backend& val, unsigned index) BOOST_NOEXCEPT { unsigned offset = index / cpp_int_backend::limb_bits; unsigned shift = index % cpp_int_backend::limb_bits; @@ -2210,7 +2160,7 @@ inline void eval_bit_unset(cpp_int_backend& val, uns } template -inline void eval_bit_flip(cpp_int_backend& val, unsigned index) +inline void eval_bit_flip(cpp_int_backend& val, unsigned index) BOOST_NOEXCEPT_IF(boost::is_void::value) { unsigned offset = index / cpp_int_backend::limb_bits; unsigned shift = index % cpp_int_backend::limb_bits; @@ -2229,7 +2179,7 @@ inline void eval_bit_flip(cpp_int_backend& val, unsi } template -inline void eval_lcm(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) +inline void eval_lcm(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) BOOST_NOEXCEPT_IF(boost::is_void::value) { cpp_int_backend t; eval_gcd(t, a, b); @@ -2249,7 +2199,7 @@ inline void eval_lcm(cpp_int_backend& result, const template inline void eval_qr(const cpp_int_backend& x, const cpp_int_backend& y, - cpp_int_backend& q, cpp_int_backend& r) + cpp_int_backend& q, cpp_int_backend& r) BOOST_NOEXCEPT_IF(boost::is_void::value) { divide_unsigned_helper(&q, x, y, r); q.sign(x.sign() != y.sign()); @@ -2257,7 +2207,7 @@ inline void eval_qr(const cpp_int_backend& x, const } template -inline typename enable_if, Integer>::type eval_integer_modulus(const cpp_int_backend& x, Integer val) +inline typename enable_if, Integer>::type eval_integer_modulus(const cpp_int_backend& x, Integer val) BOOST_NOEXCEPT_IF(boost::is_void::value) { if((sizeof(Integer) <= sizeof(limb_type)) || (val <= (std::numeric_limits::max)())) { @@ -2271,7 +2221,7 @@ inline typename enable_if, Integer>::type eval_integer_modu } } template -inline typename enable_if, Integer>::type eval_integer_modulus(const cpp_int_backend& x, Integer val) +inline typename enable_if, Integer>::type eval_integer_modulus(const cpp_int_backend& x, Integer val) BOOST_NOEXCEPT_IF(boost::is_void::value) { typedef typename make_unsigned::type unsigned_type; return eval_integer_modulus(x, static_cast(std::abs(val))); diff --git a/include/boost/multiprecision/mp_number.hpp b/include/boost/multiprecision/mp_number.hpp index db19d5a7..54950bc1 100644 --- a/include/boost/multiprecision/mp_number.hpp +++ b/include/boost/multiprecision/mp_number.hpp @@ -37,14 +37,15 @@ class mp_number typedef mp_number self_type; public: typedef Backend backend_type; - mp_number(){} - mp_number(const mp_number& e) : m_backend(e.m_backend){} + BOOST_CONSTEXPR mp_number() BOOST_NOEXCEPT_IF(noexcept(Backend())) {} + mp_number(const mp_number& e) BOOST_NOEXCEPT_IF(noexcept(Backend(static_cast(std::declval())))) : m_backend(e.m_backend){} template mp_number(V v, typename enable_if, is_same, is_convertible > >::type* = 0) { m_backend = canonical_value(v); } - mp_number(const mp_number& e, unsigned digits10) : m_backend(e.m_backend, digits10){} + mp_number(const mp_number& e, unsigned digits10) BOOST_NOEXCEPT_IF(noexcept(Backend(static_cast(std::declval()), 0u))) + : m_backend(e.m_backend, digits10){} /* // // This conflicts with component based initialization (for rational and complex types) @@ -58,10 +59,10 @@ public: } */ template - mp_number(const mp_number& val) : m_backend(val.m_backend) {} + mp_number(const mp_number& val) BOOST_NOEXCEPT_IF(noexcept(Backend(static_cast(std::declval())))) : m_backend(val.m_backend) {} template - mp_number(const mp_number& val, typename enable_if >::type* = 0) + mp_number(const mp_number& val, typename enable_if >::type* = 0) BOOST_NOEXCEPT_IF(noexcept(std::declval() = std::declval())) { m_backend = val.backend(); } @@ -88,6 +89,7 @@ public: template mp_number(V v, typename enable_if, mpl::not_, is_same, is_convertible > > > >::type* = 0) + BOOST_NOEXCEPT_IF(noexcept(Backend(static_cast(std::declval())))) : m_backend(v){} template @@ -98,7 +100,7 @@ public: return *this; } - mp_number& operator=(const mp_number& e) + mp_number& operator=(const mp_number& e) BOOST_NOEXCEPT_IF(noexcept(std::declval() = static_cast(std::declval()))) { m_backend = e.m_backend; return *this; @@ -106,7 +108,7 @@ public: template typename enable_if, is_same, is_convertible >, mp_number& >::type - operator=(const V& v) + operator=(const V& v) BOOST_NOEXCEPT_IF(noexcept(std::declval() = std::declval::type>())) { m_backend = canonical_value(v); return *this; @@ -114,14 +116,14 @@ public: template typename enable_if, mpl::not_, is_same, is_convertible > > >, mp_number& >::type - operator=(const V& v) + operator=(const V& v) BOOST_NOEXCEPT_IF(noexcept(std::declval() = static_cast(std::declval()))) { m_backend = v; return *this; } template - mp_number& operator=(const mp_number& v) + mp_number& operator=(const mp_number& v) BOOST_NOEXCEPT_IF(noexcept(std::declval() = static_cast(std::declval()))) { m_backend = v.backend(); return *this; @@ -129,7 +131,7 @@ public: template typename enable_if, mp_number& >::type - operator=(const mp_number& v) + operator=(const mp_number& v) BOOST_NOEXCEPT_IF(noexcept(std::declval() = static_cast(std::declval()))) { m_backend = v.backend(); return *this; @@ -153,8 +155,8 @@ public: } #ifndef BOOST_NO_RVALUE_REFERENCES - mp_number(mp_number&& r) : m_backend(static_cast(r.m_backend)){} - mp_number& operator=(mp_number&& r) + mp_number(mp_number&& r) BOOST_NOEXCEPT : m_backend(static_cast(r.m_backend)){} + mp_number& operator=(mp_number&& r) BOOST_NOEXCEPT { m_backend.swap(r.m_backend); return *this; @@ -316,7 +318,7 @@ public: using default_ops::eval_increment; self_type temp(*this); eval_increment(m_backend); - return temp; + return BOOST_MP_MOVE(temp); } mp_number operator--(int) @@ -324,7 +326,7 @@ public: using default_ops::eval_decrement; self_type temp(*this); eval_decrement(m_backend); - return temp; + return BOOST_MP_MOVE(temp); } template @@ -491,7 +493,7 @@ public: // // swap: // - void swap(self_type& other) + void swap(self_type& other) BOOST_NOEXCEPT { m_backend.swap(other.backend()); } @@ -526,7 +528,7 @@ public: // // Default precision: // - static unsigned default_precision() + static unsigned default_precision() BOOST_NOEXCEPT { return Backend::default_precision(); } @@ -534,7 +536,7 @@ public: { Backend::default_precision(digits10); } - unsigned precision()const + unsigned precision()const BOOST_NOEXCEPT { return m_backend.precision(); } @@ -546,6 +548,7 @@ public: // Comparison: // int compare(const mp_number& o)const + BOOST_NOEXCEPT_IF(noexcept(std::declval().compare(std::declval()))) { return m_backend.compare(o.m_backend); } @@ -557,11 +560,11 @@ public: return eval_get_sign(m_backend); return m_backend.compare(canonical_value(o)); } - Backend& backend() + Backend& backend() BOOST_NOEXCEPT { return m_backend; } - const Backend& backend()const + const Backend& backend()const BOOST_NOEXCEPT { return m_backend; } @@ -603,7 +606,7 @@ private: BOOST_THROW_EXCEPTION(std::out_of_range("Can not shift by a value greater than std::numeric_limits::max().")); } template - void check_shift_range(V, const mpl::false_&, const mpl::false_&){} + void check_shift_range(V, const mpl::false_&, const mpl::false_&) BOOST_NOEXCEPT{} template void do_assign(const Exp& e, const detail::add_immediates&) @@ -611,15 +614,6 @@ private: using default_ops::eval_add; eval_add(m_backend, canonical_value(e.left().value()), canonical_value(e.right().value())); } -/* - template - void do_assign(const Exp& e, const detail::add_and_negate_immediates&) - { - using default_ops::eval_add; - eval_add(m_backend, canonical_value(e.left().value()), canonical_value(e.right().value())); - m_backend.negate(); - } -*/ template void do_assign(const Exp& e, const detail::subtract_immediates&) { @@ -1469,23 +1463,23 @@ private: // Tests if the expression contains a reference to *this: template - bool contains_self(const Exp& e)const BOOST_NOEXCEPT + BOOST_CONSTEXPR bool contains_self(const Exp& e)const BOOST_NOEXCEPT { return contains_self(e, typename Exp::arity()); } template - bool contains_self(const Exp& e, mpl::int_<0> const&)const BOOST_NOEXCEPT + BOOST_CONSTEXPR bool contains_self(const Exp& e, mpl::int_<0> const&)const BOOST_NOEXCEPT { return is_realy_self(e.value()); } template - bool contains_self(const Exp& e, mpl::int_<1> const&)const BOOST_NOEXCEPT + BOOST_CONSTEXPR bool contains_self(const Exp& e, mpl::int_<1> const&)const BOOST_NOEXCEPT { typedef typename Exp::left_type child_type; return contains_self(e.left(), typename child_type::arity()); } template - bool contains_self(const Exp& e, mpl::int_<2> const&)const BOOST_NOEXCEPT + BOOST_CONSTEXPR bool contains_self(const Exp& e, mpl::int_<2> const&)const BOOST_NOEXCEPT { typedef typename Exp::left_type child0_type; typedef typename Exp::right_type child1_type; @@ -1493,7 +1487,7 @@ private: || contains_self(e.right(), typename child1_type::arity()); } template - bool contains_self(const Exp& e, mpl::int_<3> const&)const BOOST_NOEXCEPT + BOOST_CONSTEXPR bool contains_self(const Exp& e, mpl::int_<3> const&)const BOOST_NOEXCEPT { typedef typename Exp::left_type child0_type; typedef typename Exp::middle_type child1_type; @@ -1505,12 +1499,12 @@ private: // Test if the expression is a reference to *this: template - bool is_self(const Exp& e)const BOOST_NOEXCEPT + BOOST_CONSTEXPR bool is_self(const Exp& e)const BOOST_NOEXCEPT { return is_self(e, typename Exp::arity()); } template - bool is_self(const Exp& e, mpl::int_<0> const&)const BOOST_NOEXCEPT + BOOST_CONSTEXPR bool is_self(const Exp& e, mpl::int_<0> const&)const BOOST_NOEXCEPT { return is_realy_self(e.value()); } @@ -1524,18 +1518,18 @@ private: BOOST_CONSTEXPR bool is_realy_self(const Val&)const BOOST_NOEXCEPT{ return false; } BOOST_CONSTEXPR bool is_realy_self(const self_type& v)const BOOST_NOEXCEPT{ return &v == this; } - static const Backend& canonical_value(const self_type& v) BOOST_NOEXCEPT { return v.m_backend; } + static BOOST_CONSTEXPR const Backend& canonical_value(const self_type& v) BOOST_NOEXCEPT { return v.m_backend; } template - static typename detail::canonical::type canonical_value(const V& v) BOOST_NOEXCEPT { return static_cast::type>(v); } + static BOOST_CONSTEXPR typename detail::canonical::type canonical_value(const V& v) BOOST_NOEXCEPT { return static_cast::type>(v); } static typename detail::canonical::type canonical_value(const std::string& v) BOOST_NOEXCEPT { return v.c_str(); } - static const Backend& function_arg_value(const self_type& v) BOOST_NOEXCEPT { return v.backend(); } + static BOOST_CONSTEXPR const Backend& function_arg_value(const self_type& v) BOOST_NOEXCEPT { return v.backend(); } template - static const V& function_arg_value(const V& v) BOOST_NOEXCEPT { return v; } + static BOOST_CONSTEXPR const V& function_arg_value(const V& v) BOOST_NOEXCEPT { return v; } template static const A1& function_arg_value(const detail::mp_exp& exp) BOOST_NOEXCEPT { return exp.value(); } template - static const Backend& function_arg_value(const detail::mp_exp, A2, A3, A4>& exp) BOOST_NOEXCEPT { return exp.value().backend(); } + static BOOST_CONSTEXPR const Backend& function_arg_value(const detail::mp_exp, A2, A3, A4>& exp) BOOST_NOEXCEPT { return exp.value().backend(); } Backend m_backend; }; diff --git a/performance/Jamfile.v2 b/performance/Jamfile.v2 index be2cc779..66d35e7f 100644 --- a/performance/Jamfile.v2 +++ b/performance/Jamfile.v2 @@ -53,7 +53,16 @@ exe performance_test : performance_test.cpp /boost/system//boost_system TEST_CPP_INT ; -exe sf_performance : sf_performance.cpp /boost/system//boost_system /boost/system//boost_chrono /boost/system//boost_thread +exe miller_rabin_performance : miller_rabin_performance.cpp /boost/system//boost_system /boost/chrono//boost_chrono + : release + [ check-target-builds ../config//has_gmp : TEST_MPF TEST_MPZ gmp : ] + [ check-target-builds ../config//has_mpfr : TEST_MPFR mpfr : ] + #[ check-target-builds ../config//has_tommath : TEST_TOMMATH $(TOMMATH) : ] + TEST_CPP_DEC_FLOAT + TEST_CPP_INT + ; + +exe sf_performance : sf_performance.cpp /boost/system//boost_system /boost/chrono//boost_chrono /boost/thread//boost_thread : release [ check-target-builds ../config//has_gmp : TEST_MPF TEST_MPZ gmp : ] [ check-target-builds ../config//has_mpfr : TEST_MPFR mpfr : ] @@ -105,5 +114,8 @@ exe linpack_benchmark_double : obj_linpack_benchmark_double f2c : release ; -install . : performance_test sf_performance linpack_benchmark_double linpack_benchmark_cpp_float linpack_benchmark_mpf linpack_benchmark_mpfr ; +install miller_rabin_install : miller_rabin_performance : . ; +install performance_test_install : performance_test : . ; +install sf_performance_install : sf_performance : . ; +install . : linpack_benchmark_double linpack_benchmark_cpp_float linpack_benchmark_mpf linpack_benchmark_mpfr ; diff --git a/performance/miller_rabin_performance.cpp b/performance/miller_rabin_performance.cpp index e0c32dc3..458c14b2 100644 --- a/performance/miller_rabin_performance.cpp +++ b/performance/miller_rabin_performance.cpp @@ -138,11 +138,10 @@ int main() #ifdef TEST_CPP_INT test_miller_rabin, false> >("cpp_int (no Expression templates)"); test_miller_rabin("cpp_int"); - test_miller_rabin, false> >("cpp_int (64-bit cache)"); - test_miller_rabin, false> >("cpp_int (256-bit cache)"); - test_miller_rabin, false> >("cpp_int (512-bit cache)"); - test_miller_rabin, false> >("cpp_int (1024-bit cache)"); - test_miller_rabin, false> >("mp_int1024_t (no Expression templates)"); + test_miller_rabin > >("cpp_int (64-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)"); test_miller_rabin("mp_int1024_t"); #endif #ifdef TEST_MPZ diff --git a/performance/sf_performance.cpp b/performance/sf_performance.cpp index f748a5a9..2e66acd9 100644 --- a/performance/sf_performance.cpp +++ b/performance/sf_performance.cpp @@ -273,8 +273,12 @@ int main() mpfr::mpreal::set_default_prec(50 * 1000L / 301L); #endif #ifdef TEST_MPFR +#if MPFR_VERSION, 1); +#else time_proc("mpfr_float_50", test_bessel, mpfr_buildopt_tls_p() ? 3 : 1); #endif +#endif #ifdef TEST_MPF time_proc("mpf_float_50", test_bessel, 3); time_proc("mpf_float_50 (no expression templates", test_bessel, false> >, 3);