Disable some overloads which use rearrangements not suitable for integer types.

See https://svn.boost.org/trac/boost/ticket/9802.
This commit is contained in:
jzmaddock
2014-03-26 13:37:04 +00:00
parent 373fa10e18
commit 9eb732b956

View File

@@ -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 <class Exp>
void do_multiplies(const Exp& e, const detail::divides&)
typename boost::disable_if_c<boost::multiprecision::number_category<self_type>::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 <class Exp>
void do_multiplies(const Exp& e, const detail::divide_immediates&)
typename boost::disable_if_c<boost::multiprecision::number_category<self_type>::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 <class Exp>
void do_divide(const Exp& e, const detail::multiplies&)
typename boost::disable_if_c<boost::multiprecision::number_category<self_type>::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 <class Exp>
void do_divide(const Exp& e, const detail::divides&)
typename boost::disable_if_c<boost::multiprecision::number_category<self_type>::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 <class Exp>
void do_divides(const Exp& e, const detail::multiply_immediates&)
typename boost::disable_if_c<boost::multiprecision::number_category<self_type>::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 <class Exp>
void do_divides(const Exp& e, const detail::divide_immediates&)
typename boost::disable_if_c<boost::multiprecision::number_category<self_type>::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;