mirror of
https://github.com/boostorg/multiprecision.git
synced 2026-02-20 02:42:26 +00:00
Fix gcc build failures and warnings
[SVN r82604]
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#define BOOST_MATH_DEBUG_ADAPTER_HPP
|
||||
|
||||
#include <boost/multiprecision/traits/extract_exponent_type.hpp>
|
||||
#include <boost/multiprecision/detail/integer_ops.hpp>
|
||||
|
||||
namespace boost{
|
||||
namespace multiprecision{
|
||||
@@ -412,7 +413,7 @@ struct number_category<backends::debug_adaptor<Backend> > : public number_catego
|
||||
namespace std{
|
||||
|
||||
template <class Backend, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
class numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<Backend>, ExpressionTemplates> >
|
||||
class numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<Backend>, ExpressionTemplates> >
|
||||
: public std::numeric_limits<boost::multiprecision::number<Backend, ExpressionTemplates> >
|
||||
{
|
||||
typedef std::numeric_limits<boost::multiprecision::number<Backend, ExpressionTemplates> > base_type;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#define BOOST_MATH_LOGGED_ADAPTER_HPP
|
||||
|
||||
#include <boost/multiprecision/traits/extract_exponent_type.hpp>
|
||||
#include <boost/multiprecision/detail/integer_ops.hpp>
|
||||
|
||||
namespace boost{
|
||||
namespace multiprecision{
|
||||
@@ -398,7 +399,7 @@ inline void eval_bit_set(const logged_adaptor<Backend>& arg, unsigned a)
|
||||
using default_ops::eval_bit_set;
|
||||
log_prefix_event(arg.value(), a, "bit-set");
|
||||
eval_bit_set(arg.value(), a);
|
||||
log_postfix_event(arg.value(), r, "bit-set");
|
||||
log_postfix_event(arg.value(), arg, "bit-set");
|
||||
}
|
||||
template <class Backend>
|
||||
inline void eval_bit_unset(const logged_adaptor<Backend>& arg, unsigned a)
|
||||
@@ -406,7 +407,7 @@ inline void eval_bit_unset(const logged_adaptor<Backend>& arg, unsigned a)
|
||||
using default_ops::eval_bit_unset;
|
||||
log_prefix_event(arg.value(), a, "bit-unset");
|
||||
eval_bit_unset(arg.value(), a);
|
||||
log_postfix_event(arg.value(), r, "bit-unset");
|
||||
log_postfix_event(arg.value(), arg, "bit-unset");
|
||||
}
|
||||
template <class Backend>
|
||||
inline void eval_bit_flip(const logged_adaptor<Backend>& arg, unsigned a)
|
||||
@@ -414,7 +415,7 @@ inline void eval_bit_flip(const logged_adaptor<Backend>& arg, unsigned a)
|
||||
using default_ops::eval_bit_flip;
|
||||
log_prefix_event(arg.value(), a, "bit-flip");
|
||||
eval_bit_flip(arg.value(), a);
|
||||
log_postfix_event(arg.value(), r, "bit-flip");
|
||||
log_postfix_event(arg.value(), arg, "bit-flip");
|
||||
}
|
||||
|
||||
NON_MEMBER_OP3(gcd, "gcd");
|
||||
@@ -466,7 +467,7 @@ struct number_category<backends::logged_adaptor<Backend> > : public number_categ
|
||||
namespace std{
|
||||
|
||||
template <class Backend, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
class numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<Backend>, ExpressionTemplates> >
|
||||
class numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::logged_adaptor<Backend>, ExpressionTemplates> >
|
||||
: public std::numeric_limits<boost::multiprecision::number<Backend, ExpressionTemplates> >
|
||||
{
|
||||
typedef std::numeric_limits<boost::multiprecision::number<Backend, ExpressionTemplates> > base_type;
|
||||
|
||||
@@ -1246,14 +1246,14 @@ inline void eval_pow(mpfr_float_backend<Digits10, AllocateType>& result, const m
|
||||
#endif
|
||||
|
||||
template <unsigned Digits10, mpfr_allocation_type AllocateType, class Integer>
|
||||
inline typename enable_if<mpl::and_<is_signed<Integer>, mpl::bool_<BOOST_MP_ENABLE_IF_WORKAROUND (sizeof(Integer) <= sizeof(long))> > >::type
|
||||
inline typename enable_if<mpl::and_<is_signed<Integer>, mpl::bool_<BOOST_MP_ENABLE_IF_WORKAROUND (sizeof(Integer) <= sizeof(long))> > >::type
|
||||
eval_pow(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& b, const Integer& e)
|
||||
{
|
||||
mpfr_pow_si(result.data(), b.data(), e, GMP_RNDN);
|
||||
}
|
||||
|
||||
template <unsigned Digits10, mpfr_allocation_type AllocateType, class Integer>
|
||||
inline typename enable_if<mpl::and_<is_unsigned<Integer>, mpl::bool_<BOOST_MP_ENABLE_IF_WORKAROUND (sizeof(Integer) <= sizeof(long))> > >::type
|
||||
inline typename enable_if<mpl::and_<is_unsigned<Integer>, mpl::bool_<BOOST_MP_ENABLE_IF_WORKAROUND (sizeof(Integer) <= sizeof(long))> > >::type
|
||||
eval_pow(mpfr_float_backend<Digits10, AllocateType>& result, const mpfr_float_backend<Digits10, AllocateType>& b, const Integer& e)
|
||||
{
|
||||
mpfr_pow_ui(result.data(), b.data(), e, GMP_RNDN);
|
||||
@@ -1392,15 +1392,47 @@ template <class T> struct constant_ln_two;
|
||||
template <class T> struct constant_euler;
|
||||
template <class T> struct constant_catalan;
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <class T, int N>
|
||||
struct mpfr_constant_initializer
|
||||
{
|
||||
static void force_instantiate()
|
||||
{
|
||||
init.force_instantiate();
|
||||
}
|
||||
private:
|
||||
struct initializer
|
||||
{
|
||||
initializer()
|
||||
{
|
||||
T::get(mpl::int_<N>());
|
||||
}
|
||||
void force_instantiate()const{}
|
||||
};
|
||||
static const initializer init;
|
||||
};
|
||||
|
||||
template <class T, int N>
|
||||
typename mpfr_constant_initializer<T, N>::initializer const mpfr_constant_initializer<T, N>::init;
|
||||
|
||||
}
|
||||
|
||||
template<unsigned Digits10, boost::multiprecision::mpfr_allocation_type AllocateType, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct constant_pi<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >
|
||||
{
|
||||
typedef boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> result_type;
|
||||
template<int N>
|
||||
static inline result_type get(const mpl::int_<N>&)
|
||||
static inline const result_type& get(const mpl::int_<N>&)
|
||||
{
|
||||
result_type result;
|
||||
mpfr_const_pi(result.backend().data(), GMP_RNDN);
|
||||
detail::mpfr_constant_initializer<constant_pi<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >, N>::force_instantiate();
|
||||
static result_type result;
|
||||
static bool has_init = false;
|
||||
if(!has_init)
|
||||
{
|
||||
mpfr_const_pi(result.backend().data(), GMP_RNDN);
|
||||
has_init = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
@@ -1409,10 +1441,16 @@ struct constant_ln_two<boost::multiprecision::number<boost::multiprecision::mpfr
|
||||
{
|
||||
typedef boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> result_type;
|
||||
template<int N>
|
||||
static inline result_type get(const mpl::int_<N>&)
|
||||
static inline const result_type& get(const mpl::int_<N>&)
|
||||
{
|
||||
result_type result;
|
||||
mpfr_const_log2(result.backend().data(), GMP_RNDN);
|
||||
detail::mpfr_constant_initializer<constant_ln_two<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >, N>::force_instantiate();
|
||||
static result_type result;
|
||||
static bool init = false;
|
||||
if(!init)
|
||||
{
|
||||
mpfr_const_log2(result.backend().data(), GMP_RNDN);
|
||||
init = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
@@ -1421,10 +1459,16 @@ struct constant_euler<boost::multiprecision::number<boost::multiprecision::mpfr_
|
||||
{
|
||||
typedef boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> result_type;
|
||||
template<int N>
|
||||
static inline result_type get(const mpl::int_<N>&)
|
||||
static inline const result_type& get(const mpl::int_<N>&)
|
||||
{
|
||||
result_type result;
|
||||
mpfr_const_euler(result.backend().data(), GMP_RNDN);
|
||||
detail::mpfr_constant_initializer<constant_euler<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >, N>::force_instantiate();
|
||||
static result_type result;
|
||||
static bool init = false;
|
||||
if(!init)
|
||||
{
|
||||
mpfr_const_euler(result.backend().data(), GMP_RNDN);
|
||||
init = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
@@ -1433,10 +1477,16 @@ struct constant_catalan<boost::multiprecision::number<boost::multiprecision::mpf
|
||||
{
|
||||
typedef boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> result_type;
|
||||
template<int N>
|
||||
static inline result_type get(const mpl::int_<N>&)
|
||||
static inline const result_type& get(const mpl::int_<N>&)
|
||||
{
|
||||
result_type result;
|
||||
mpfr_const_catalan(result.backend().data(), GMP_RNDN);
|
||||
detail::mpfr_constant_initializer<constant_catalan<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10, AllocateType>, ExpressionTemplates> >, N>::force_instantiate();
|
||||
static result_type result;
|
||||
static bool init = false;
|
||||
if(!init)
|
||||
{
|
||||
mpfr_const_catalan(result.backend().data(), GMP_RNDN);
|
||||
init = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user