mirror of
https://github.com/boostorg/multiprecision.git
synced 2026-02-18 14:12:32 +00:00
Fix a few GCC warnings and errors
[SVN r80115]
This commit is contained in:
@@ -725,10 +725,16 @@ inline void eval_round(T& result, const T& a)
|
||||
}
|
||||
}
|
||||
|
||||
template <class B>
|
||||
void eval_lcm(B& result, const B& a, const B& b);
|
||||
template <class B>
|
||||
void eval_gcd(B& result, const B& a, const B& b);
|
||||
|
||||
template <class T, class Arithmetic>
|
||||
inline typename enable_if<is_integral<Arithmetic> >::type eval_gcd(T& result, const T& a, const Arithmetic& b)
|
||||
{
|
||||
typedef typename boost::multiprecision::detail::canonical<Arithmetic, T>::type si_type;
|
||||
using default_ops::eval_gcd;
|
||||
T t;
|
||||
t = static_cast<si_type>(b);
|
||||
eval_gcd(result, a, t);
|
||||
@@ -742,6 +748,7 @@ template <class T, class Arithmetic>
|
||||
inline typename enable_if<is_integral<Arithmetic> >::type eval_lcm(T& result, const T& a, const Arithmetic& b)
|
||||
{
|
||||
typedef typename boost::multiprecision::detail::canonical<Arithmetic, T>::type si_type;
|
||||
using default_ops::eval_lcm;
|
||||
T t;
|
||||
t = static_cast<si_type>(b);
|
||||
eval_lcm(result, a, t);
|
||||
@@ -813,11 +820,6 @@ inline void eval_bit_unset(T& val, unsigned index)
|
||||
eval_bitwise_xor(val, mask);
|
||||
}
|
||||
|
||||
template <class B>
|
||||
void eval_lcm(B& result, const B& a, const B& b);
|
||||
template <class B>
|
||||
void eval_gcd(B& result, const B& a, const B& b);
|
||||
|
||||
//
|
||||
// These have to implemented by the backend, declared here so that our macro generated code compiles OK.
|
||||
//
|
||||
|
||||
@@ -66,6 +66,7 @@ void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_
|
||||
using default_ops::eval_right_shift;
|
||||
using default_ops::eval_left_shift;
|
||||
using default_ops::eval_bitwise_or;
|
||||
using default_ops::eval_is_zero;
|
||||
// smallest unsigned type handled natively by "From" is likely to be it's limb_type:
|
||||
typedef typename canonical<unsigned char, From>::type limb_type;
|
||||
// get the corresponding type that we can assign to "To":
|
||||
|
||||
@@ -309,7 +309,7 @@ void eval_powm(Backend& result, const Backend& a, const Backend& p, Integer c)
|
||||
}
|
||||
|
||||
template <class Backend, class Integer>
|
||||
void eval_powm(Backend& result, const Backend& a, Integer b, const Backend& c)
|
||||
typename enable_if<is_unsigned<Integer> >::type eval_powm(Backend& result, const Backend& a, Integer b, const Backend& c)
|
||||
{
|
||||
typedef typename canonical<unsigned char, Backend>::type ui_type;
|
||||
typedef typename canonical<Integer, Backend>::type i_type;
|
||||
@@ -320,11 +320,6 @@ void eval_powm(Backend& result, const Backend& a, Integer b, const Backend& c)
|
||||
using default_ops::eval_modulus;
|
||||
using default_ops::eval_right_shift;
|
||||
|
||||
if(b < 0)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("powm requires a positive exponent."));
|
||||
}
|
||||
|
||||
Backend x, y(a);
|
||||
x = ui_type(1u);
|
||||
while(b > 0)
|
||||
@@ -341,8 +336,18 @@ void eval_powm(Backend& result, const Backend& a, Integer b, const Backend& c)
|
||||
eval_modulus(result, x, c);
|
||||
}
|
||||
|
||||
template <class Backend, class Integer>
|
||||
typename enable_if<is_signed<Integer> >::type eval_powm(Backend& result, const Backend& a, Integer b, const Backend& c)
|
||||
{
|
||||
if(b < 0)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("powm requires a positive exponent."));
|
||||
}
|
||||
eval_powm(result, a, static_cast<typename make_unsigned<Integer>::type>(b), c);
|
||||
}
|
||||
|
||||
template <class Backend, class Integer1, class Integer2>
|
||||
void eval_powm(Backend& result, const Backend& a, Integer1 b, Integer2 c)
|
||||
typename enable_if<is_unsigned<Integer1> >::type eval_powm(Backend& result, const Backend& a, Integer1 b, Integer2 c)
|
||||
{
|
||||
typedef typename canonical<unsigned char, Backend>::type ui_type;
|
||||
typedef typename canonical<Integer1, Backend>::type i1_type;
|
||||
@@ -354,11 +359,6 @@ void eval_powm(Backend& result, const Backend& a, Integer1 b, Integer2 c)
|
||||
using default_ops::eval_modulus;
|
||||
using default_ops::eval_right_shift;
|
||||
|
||||
if(b < 0)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("powm requires a positive exponent."));
|
||||
}
|
||||
|
||||
Backend x, y(a);
|
||||
x = ui_type(1u);
|
||||
while(b > 0)
|
||||
@@ -375,6 +375,16 @@ void eval_powm(Backend& result, const Backend& a, Integer1 b, Integer2 c)
|
||||
eval_modulus(result, x, static_cast<i2_type>(c));
|
||||
}
|
||||
|
||||
template <class Backend, class Integer1, class Integer2>
|
||||
typename enable_if<is_signed<Integer1> >::type eval_powm(Backend& result, const Backend& a, Integer1 b, Integer2 c)
|
||||
{
|
||||
if(b < 0)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("powm requires a positive exponent."));
|
||||
}
|
||||
eval_powm(result, a, static_cast<typename make_unsigned<Integer1>::type>(b), c);
|
||||
}
|
||||
|
||||
struct powm_func
|
||||
{
|
||||
template <class T, class U, class V>
|
||||
|
||||
Reference in New Issue
Block a user