diff --git a/include/boost/multiprecision/number.hpp b/include/boost/multiprecision/number.hpp index 0f5b0ae0..6d1746af 100644 --- a/include/boost/multiprecision/number.hpp +++ b/include/boost/multiprecision/number.hpp @@ -1382,9 +1382,13 @@ private: do_multiplies(e.left(), typename left_type::tag_type()); do_multiplies(e.right(), typename right_type::tag_type()); } - + // + // This rearrangement is disabled for integer types, the test on sizeof(Exp) is simply to make + // the disable_if dependent on the template argument (the size of 1 can never occur in practice). + // template - void do_multiplies(const Exp& e, const detail::divides&) + typename boost::disable_if_c::value == boost::multiprecision::number_kind_integer || sizeof(Exp) == 1>::type + do_multiplies(const Exp& e, const detail::divides&) { typedef typename Exp::left_type left_type; typedef typename Exp::right_type right_type; @@ -1399,8 +1403,13 @@ private: eval_multiply(m_backend, canonical_value(e.left().value())); eval_multiply(m_backend, canonical_value(e.right().value())); } + // + // This rearrangement is disabled for integer types, the test on sizeof(Exp) is simply to make + // the disable_if dependent on the template argument (the size of 1 can never occur in practice). + // template - void do_multiplies(const Exp& e, const detail::divide_immediates&) + typename boost::disable_if_c::value == boost::multiprecision::number_kind_integer || sizeof(Exp) == 1>::type + do_multiplies(const Exp& e, const detail::divide_immediates&) { using default_ops::eval_multiply; using default_ops::eval_divide; @@ -1429,34 +1438,51 @@ private: do_divide(e.left(), typename left_type::tag_type()); m_backend.negate(); } - + // + // This rearrangement is disabled for integer types, the test on sizeof(Exp) is simply to make + // the disable_if dependent on the template argument (the size of 1 can never occur in practice). + // template - void do_divide(const Exp& e, const detail::multiplies&) + typename boost::disable_if_c::value == boost::multiprecision::number_kind_integer || sizeof(Exp) == 1>::type + do_divide(const Exp& e, const detail::multiplies&) { typedef typename Exp::left_type left_type; typedef typename Exp::right_type right_type; do_divide(e.left(), typename left_type::tag_type()); do_divide(e.right(), typename right_type::tag_type()); } - + // + // This rearrangement is disabled for integer types, the test on sizeof(Exp) is simply to make + // the disable_if dependent on the template argument (the size of 1 can never occur in practice). + // template - void do_divide(const Exp& e, const detail::divides&) + typename boost::disable_if_c::value == boost::multiprecision::number_kind_integer || sizeof(Exp) == 1>::type + do_divide(const Exp& e, const detail::divides&) { typedef typename Exp::left_type left_type; typedef typename Exp::right_type right_type; do_divide(e.left(), typename left_type::tag_type()); do_multiplies(e.right(), typename right_type::tag_type()); } - + // + // This rearrangement is disabled for integer types, the test on sizeof(Exp) is simply to make + // the disable_if dependent on the template argument (the size of 1 can never occur in practice). + // template - void do_divides(const Exp& e, const detail::multiply_immediates&) + typename boost::disable_if_c::value == boost::multiprecision::number_kind_integer || sizeof(Exp) == 1>::type + do_divides(const Exp& e, const detail::multiply_immediates&) { using default_ops::eval_divide; eval_divide(m_backend, canonical_value(e.left().value())); eval_divide(m_backend, canonical_value(e.right().value())); } + // + // This rearrangement is disabled for integer types, the test on sizeof(Exp) is simply to make + // the disable_if dependent on the template argument (the size of 1 can never occur in practice). + // template - void do_divides(const Exp& e, const detail::divide_immediates&) + typename boost::disable_if_c::value == boost::multiprecision::number_kind_integer || sizeof(Exp) == 1>::type + do_divides(const Exp& e, const detail::divide_immediates&) { using default_ops::eval_multiply; using default_ops::eval_divide;