mirror of
https://github.com/boostorg/multiprecision.git
synced 2026-07-21 13:23:49 +00:00
Completely remove MPL usage.
This commit is contained in:
@@ -30,11 +30,11 @@ and `ff` is a variable of type `std::ios_base::fmtflags`.
|
||||
|
||||
[table Compulsory Requirements on the Backend type.
|
||||
[[Expression][Return Type][Comments][Throws]]
|
||||
[[`B::signed_types`][`mpl::list<type-list>`][A list of signed integral types that can be assigned to type B. The types shall be
|
||||
[[`B::signed_types`][`std::tuple<type-list>`][A list of signed integral types that can be assigned to type B. The types shall be
|
||||
listed in order of size, smallest first, and shall terminate in the type that is `std::intmax_t`.][[space]]]
|
||||
[[`B::unsigned_types`][`mpl::list<type-list>`][A list of unsigned integral types that can be assigned to type B. The types shall be
|
||||
[[`B::unsigned_types`][`std::tuple<type-list>`][A list of unsigned integral types that can be assigned to type B. The types shall be
|
||||
listed in order of size, smallest first, and shall terminate in the type that is `std::uintmax_t`.][[space]]]
|
||||
[[`B::float_types`][`mpl::list<type-list>`][A list of floating-point types that can be assigned to type B.The types shall be
|
||||
[[`B::float_types`][`std::tuple<type-list>`][A list of floating-point types that can be assigned to type B.The types shall be
|
||||
listed in order of size, smallest first, and shall terminate in type `long double`.][[space]]]
|
||||
[[`B::exponent_type`][A signed integral type.][The type of the exponent of type B. This type is required only for floating-point types.][[space]]]
|
||||
[[`B()`][ ][Default constructor.][[space]]]
|
||||
@@ -77,7 +77,7 @@ and `ff` is a variable of type `std::ios_base::fmtflags`.
|
||||
[[`eval_floor(b, cb)`][`void`][Stores the floor of `cb` in `b`, only required when `B` is a floating-point type.][[space]]]
|
||||
[[`eval_ceil(b, cb)`][`void`][Stores the ceiling of `cb` in `b`, only required when `B` is a floating-point type.][[space]]]
|
||||
[[`eval_sqrt(b, cb)`][`void`][Stores the square root of `cb` in `b`, only required when `B` is a floating-point type.][[space]]]
|
||||
[[`boost::multiprecision::number_category<B>::type`][`mpl::int_<N>`][`N` is one of the values `number_kind_integer`, `number_kind_floating_point`, `number_kind_complex`, `number_kind_rational` or `number_kind_fixed_point`.
|
||||
[[`boost::multiprecision::number_category<B>::type`][`std::integral_constant<int, N>`][`N` is one of the values `number_kind_integer`, `number_kind_floating_point`, `number_kind_complex`, `number_kind_rational` or `number_kind_fixed_point`.
|
||||
Defaults to `number_kind_floating_point`.][[space]]]
|
||||
[[`eval_conj(b, cb)`][`void`][Sets `b` to the complex conjugate of `cb`. Required for complex types only - other types have a sensible default.][[space]]]
|
||||
[[`eval_proj(b, cb)`][`void`][Sets `b` to the Riemann projection of `cb`. Required for complex types only - other types have a sensible default.][[space]]]
|
||||
@@ -141,11 +141,11 @@ and `ff` is a variable of type `std::ios_base::fmtflags`.
|
||||
When not provided, the default implementation returns `eval_lt(cb, a)`.][[space]]]
|
||||
[[`eval_is_zero(cb)`][`bool`][Returns `true` if `cb` is zero, otherwise `false`. The default version of this function
|
||||
returns `cb.compare(ui_type(0)) == 0`, where `ui_type` is `ui_type` is
|
||||
`typename mpl::front<typename B::unsigned_types>::type`.][[space]]]
|
||||
`typename std::tuple_element<0, typename B::unsigned_types>::type`.][[space]]]
|
||||
[[`eval_get_sign(cb)`][`int`][Returns a value < zero if `cb` is negative, a value > zero if `cb` is positive, and zero if `cb` is zero.
|
||||
The default version of this function
|
||||
returns `cb.compare(ui_type(0))`, where `ui_type` is `ui_type` is
|
||||
`typename mpl::front<typename B::unsigned_types>::type`.][[space]]]
|
||||
`typename std::tuple_element<0, typename B::unsigned_types>::type`.][[space]]]
|
||||
|
||||
[[['Basic arithmetic:]]]
|
||||
[[`eval_add(b, a)`][`void`][Adds `a` to `b`. The type of `a` shall be listed in one of the type lists
|
||||
@@ -234,10 +234,10 @@ and `ff` is a variable of type `std::ios_base::fmtflags`.
|
||||
[`std::overflow_error` if cb has the value zero, and `std::numeric_limits<number<B> >::has_infinity == false`]]
|
||||
[[`eval_increment(b)`][void][Increments the value of `b` by one.
|
||||
When not provided, does the equivalent of `eval_add(b, static_cast<ui_type>(1u))`.
|
||||
Where `ui_type` is `typename mpl::front<typename B::unsigned_types>::type`.][[space]]]
|
||||
Where `ui_type` is `typename std::tuple_element<0, typename B::unsigned_types>::type`.][[space]]]
|
||||
[[`eval_decrement(b)`][void][Decrements the value of `b` by one.
|
||||
When not provided, does the equivalent of `eval_subtract(b, static_cast<ui_type>(1u))`.
|
||||
Where `ui_type` is `typename mpl::front<typename B::unsigned_types>::type`.][[space]]]
|
||||
Where `ui_type` is `typename std::tuple_element<0, typename B::unsigned_types>::type`.][[space]]]
|
||||
|
||||
[[['Integer specific operations:]]]
|
||||
[[`eval_modulus(b, a)`][`void`][Computes `b %= cb`, only required when `B` is an integer type. The type of `a` shall be listed in one of the type lists
|
||||
|
||||
@@ -51,7 +51,7 @@ given the limitations of the type and our internal requirements".]]
|
||||
given the limitations of the type and our internal requirements".]]
|
||||
]
|
||||
|
||||
The type of `number_category<cpp_bin_float<Args...> >::type` is `mpl::int_<number_kind_floating_point>`.
|
||||
The type of `number_category<cpp_bin_float<Args...> >::type` is `std::integral_constant<int, number_kind_floating_point>`.
|
||||
|
||||
More information on this type can be found in the [link boost_multiprecision.tut.floats.cpp_bin_float tutorial].
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ template argument should not be set too high or the class's size will grow unrea
|
||||
allocation is performed, but can be set to a standard library allocator if dynamic allocation makes more sense.]]
|
||||
]
|
||||
|
||||
The type of `number_category<cpp_dec_float<Args...> >::type` is `mpl::int_<number_kind_floating_point>`.
|
||||
The type of `number_category<cpp_dec_float<Args...> >::type` is `std::integral_constant<int, number_kind_floating_point>`.
|
||||
|
||||
More information on this type can be found in the [link boost_multiprecision.tut.floats.cpp_dec_float tutorial].
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ The template arguments are:
|
||||
[[Allocator][The allocator to use for dynamic memory allocation, or type `void` if MaxBits == MinBits.]]
|
||||
]
|
||||
|
||||
The type of `number_category<cpp_int<Args...> >::type` is `mpl::int_<number_kind_integer>`.
|
||||
The type of `number_category<cpp_int<Args...> >::type` is `std::integral_constant<int, number_kind_integer>`.
|
||||
|
||||
More information on this type can be found in the [link boost_multiprecision.tut.ints.cpp_int tutorial].
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ and `number::precision`. Note that this type does not in any way change the GMP
|
||||
it does not change the default precision of the mpf_t data type), therefore you can safely mix this type with existing
|
||||
code that uses GMP, and also mix `gmp_float`s of differing precision.
|
||||
|
||||
The type of `number_category<cpp_int<Args...> >::type` is `mpl::int_<number_kind_floating_point>`.
|
||||
The type of `number_category<cpp_int<Args...> >::type` is `std::integral_constant<int, number_kind_floating_point>`.
|
||||
|
||||
More information on this type can be found in the [link boost_multiprecision.tut.floats.gmp_float tutorial].
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ Class template `gmp_int` fulfils all of the requirements for a [link boost_multi
|
||||
Its members and non-member functions are deliberately not documented: these are considered implementation details that are subject
|
||||
to change.
|
||||
|
||||
The type of `number_category<cpp_int<Args...> >::type` is `mpl::int_<number_kind_integer>`.
|
||||
The type of `number_category<cpp_int<Args...> >::type` is `std::integral_constant<int, number_kind_integer>`.
|
||||
|
||||
More information on this type can be found in the [link boost_multiprecision.tut.ints.gmp_int tutorial].
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ authors of backend types should generally specialise one of the traits above, ra
|
||||
template <class T>
|
||||
is_unsigned_number;
|
||||
|
||||
These two traits inherit from either `mpl::true_` or `mpl::false_`, by default types are assumed to be signed unless
|
||||
These two traits inherit from either `std::integral_constant<bool, true>` or `std::integral_constant<bool, false>`, by default types are assumed to be signed unless
|
||||
`is_unsigned_number` is specialized for that type.
|
||||
|
||||
[endsect]
|
||||
|
||||
@@ -33,7 +33,7 @@ and `number::precision`. Note that this type does not in any way change the GMP
|
||||
it does not change the default precision of the mpfr_t data type), therefore you can safely mix this type with existing
|
||||
code that uses GMP or MPFR, and also mix `mpfr_float_backend`s of differing precision.
|
||||
|
||||
The type of `number_category<cpp_int<Args...> >::type` is `mpl::int_<number_kind_floating_point>`.
|
||||
The type of `number_category<cpp_int<Args...> >::type` is `std::integral_constant<int, number_kind_floating_point>`.
|
||||
|
||||
More information on this type can be found in the [link boost_multiprecision.tut.floats.mpfr_float tutorial].
|
||||
|
||||
|
||||
@@ -694,7 +694,7 @@ If this is a type with multiple components (for example rational or complex type
|
||||
template <class T>
|
||||
struct number_category;
|
||||
|
||||
A traits class that inherits from `mpl::int_<N>` where `N` is one of the enumerated values `number_kind_integer`, `number_kind_floating_point`,
|
||||
A traits class that inherits from `std::integral_constant<int, N>` where `N` is one of the enumerated values `number_kind_integer`, `number_kind_floating_point`,
|
||||
`number_kind_rational`, `number_kind_fixed_point`, or `number_kind_unknown`. This traits class is specialized for any type that has
|
||||
`std::numeric_limits` support as well as for classes in this library: which means it can be used for generic code that must work
|
||||
with __fundamental arithmetic types as well as multiprecision ones.
|
||||
@@ -702,12 +702,12 @@ with __fundamental arithmetic types as well as multiprecision ones.
|
||||
template <class T>
|
||||
struct is_number;
|
||||
|
||||
A traits class that inherits from `mpl::true_` if T is an instance of `number<>`, otherwise from `mpl::false_`.
|
||||
A traits class that inherits from `std::integral_constant<bool, true>` if T is an instance of `number<>`, otherwise from `std::integral_constant<bool, false>`.
|
||||
|
||||
template <class T>
|
||||
struct is_number_expression;
|
||||
|
||||
A traits class that inherits from `mpl::true_` if T is an expression template type derived from `number<>`, otherwise from `mpl::false_`.
|
||||
A traits class that inherits from `std::integral_constant<bool, true>` if T is an expression template type derived from `number<>`, otherwise from `std::integral_constant<bool, false>`.
|
||||
|
||||
|
||||
[h4 Integer functions]
|
||||
|
||||
@@ -22,7 +22,7 @@ Class template `tommath_int` fulfils all of the requirements for a [link boost_m
|
||||
Its members and non-member functions are deliberately not documented: these are considered implementation details that are subject
|
||||
to change.
|
||||
|
||||
The type of `number_category<cpp_int<Args...> >::type` is `mpl::int_<number_kind_integer>`.
|
||||
The type of `number_category<cpp_int<Args...> >::type` is `std::integral_constant<int, number_kind_integer>`.
|
||||
|
||||
More information on this type can be found in the [link boost_multiprecision.tut.ints.tom_int tutorial].
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ struct complex_adaptor
|
||||
template <class V>
|
||||
complex_adaptor& operator=(const V& v)
|
||||
{
|
||||
typedef typename mpl::front<unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, unsigned_types>::type ui_type;
|
||||
m_real = v;
|
||||
m_imag = ui_type(0u);
|
||||
return *this;
|
||||
@@ -102,7 +102,7 @@ struct complex_adaptor
|
||||
}
|
||||
complex_adaptor& operator=(const char* s)
|
||||
{
|
||||
typedef typename mpl::front<unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, unsigned_types>::type ui_type;
|
||||
ui_type zero = 0u;
|
||||
|
||||
using default_ops::eval_fpclassify;
|
||||
@@ -370,7 +370,7 @@ inline void eval_sqrt(complex_adaptor<Backend>& result, const complex_adaptor<Ba
|
||||
|
||||
if (eval_is_zero(val.imag_data()) && (eval_get_sign(val.real_data()) >= 0))
|
||||
{
|
||||
static const typename mpl::front<typename Backend::unsigned_types>::type zero = 0u;
|
||||
static const typename std::tuple_element<0, typename Backend::unsigned_types>::type zero = 0u;
|
||||
eval_sqrt(result.real_data(), val.real_data());
|
||||
result.imag_data() = zero;
|
||||
return;
|
||||
@@ -433,7 +433,7 @@ inline void eval_pow(complex_adaptor<Backend>& result, const complex_adaptor<Bac
|
||||
|
||||
if (eval_is_zero(e))
|
||||
{
|
||||
typename mpl::front<typename Backend::unsigned_types>::type one(1);
|
||||
typename std::tuple_element<0, typename Backend::unsigned_types>::type one(1);
|
||||
result = one;
|
||||
return;
|
||||
}
|
||||
@@ -449,7 +449,7 @@ inline void eval_pow(complex_adaptor<Backend>& result, const complex_adaptor<Bac
|
||||
{
|
||||
Backend n = std::numeric_limits<number<Backend> >::infinity().backend();
|
||||
result.real_data() = n;
|
||||
typename mpl::front<typename Backend::unsigned_types>::type zero(0);
|
||||
typename std::tuple_element<0, typename Backend::unsigned_types>::type zero(0);
|
||||
if (eval_is_zero(e.imag_data()))
|
||||
result.imag_data() = zero;
|
||||
else
|
||||
@@ -457,7 +457,7 @@ inline void eval_pow(complex_adaptor<Backend>& result, const complex_adaptor<Bac
|
||||
}
|
||||
else
|
||||
{
|
||||
typename mpl::front<typename Backend::unsigned_types>::type zero(0);
|
||||
typename std::tuple_element<0, typename Backend::unsigned_types>::type zero(0);
|
||||
result = zero;
|
||||
}
|
||||
return;
|
||||
@@ -480,7 +480,7 @@ inline void eval_exp(complex_adaptor<Backend>& result, const complex_adaptor<Bac
|
||||
if (eval_is_zero(arg.imag_data()))
|
||||
{
|
||||
eval_exp(result.real_data(), arg.real_data());
|
||||
typename mpl::front<typename Backend::unsigned_types>::type zero(0);
|
||||
typename std::tuple_element<0, typename Backend::unsigned_types>::type zero(0);
|
||||
result.imag_data() = zero;
|
||||
return;
|
||||
}
|
||||
@@ -509,7 +509,7 @@ inline void eval_log(complex_adaptor<Backend>& result, const complex_adaptor<Bac
|
||||
if (eval_is_zero(arg.imag_data()) && (eval_get_sign(arg.real_data()) >= 0))
|
||||
{
|
||||
eval_log(result.real_data(), arg.real_data());
|
||||
typename mpl::front<typename Backend::unsigned_types>::type zero(0);
|
||||
typename std::tuple_element<0, typename Backend::unsigned_types>::type zero(0);
|
||||
result.imag_data() = zero;
|
||||
return;
|
||||
}
|
||||
@@ -529,7 +529,7 @@ inline void eval_log10(complex_adaptor<Backend>& result, const complex_adaptor<B
|
||||
using default_ops::eval_divide;
|
||||
using default_ops::eval_log;
|
||||
|
||||
typedef typename mpl::front<typename Backend::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type;
|
||||
|
||||
Backend ten;
|
||||
ten = ui_type(10);
|
||||
@@ -587,7 +587,7 @@ void tanh_imp(const T& r, const T& i, T& r_result, T& i_result)
|
||||
using default_ops::eval_fpclassify;
|
||||
using default_ops::eval_get_sign;
|
||||
|
||||
typedef typename boost::mpl::front<typename T::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type;
|
||||
ui_type one(1);
|
||||
//
|
||||
// Set:
|
||||
@@ -671,7 +671,7 @@ inline void eval_asin(complex_adaptor<Backend>& result, const complex_adaptor<Ba
|
||||
template <class Backend>
|
||||
inline void eval_acos(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
||||
{
|
||||
typedef typename mpl::front<typename Backend::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type;
|
||||
|
||||
using default_ops::eval_asin;
|
||||
|
||||
@@ -686,7 +686,7 @@ inline void eval_acos(complex_adaptor<Backend>& result, const complex_adaptor<Ba
|
||||
template <class Backend>
|
||||
inline void eval_atan(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
||||
{
|
||||
typedef typename mpl::front<typename Backend::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type;
|
||||
ui_type one = (ui_type)1u;
|
||||
|
||||
using default_ops::eval_add;
|
||||
@@ -751,7 +751,7 @@ inline void eval_cosh(complex_adaptor<Backend>& result, const complex_adaptor<Ba
|
||||
template <class Backend>
|
||||
inline void eval_asinh(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
||||
{
|
||||
typedef typename mpl::front<typename Backend::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type;
|
||||
ui_type one = (ui_type)1u;
|
||||
|
||||
using default_ops::eval_add;
|
||||
@@ -769,7 +769,7 @@ inline void eval_asinh(complex_adaptor<Backend>& result, const complex_adaptor<B
|
||||
template <class Backend>
|
||||
inline void eval_acosh(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
||||
{
|
||||
typedef typename mpl::front<typename Backend::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type;
|
||||
ui_type one = (ui_type)1u;
|
||||
|
||||
using default_ops::eval_add;
|
||||
@@ -794,7 +794,7 @@ inline void eval_acosh(complex_adaptor<Backend>& result, const complex_adaptor<B
|
||||
template <class Backend>
|
||||
inline void eval_atanh(complex_adaptor<Backend>& result, const complex_adaptor<Backend>& arg)
|
||||
{
|
||||
typedef typename mpl::front<typename Backend::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type;
|
||||
ui_type one = (ui_type)1u;
|
||||
|
||||
using default_ops::eval_add;
|
||||
@@ -826,7 +826,7 @@ inline void eval_proj(complex_adaptor<Backend>& result, const complex_adaptor<Ba
|
||||
{
|
||||
using default_ops::eval_get_sign;
|
||||
|
||||
typedef typename mpl::front<typename Backend::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type;
|
||||
ui_type zero = (ui_type)0u;
|
||||
|
||||
int c1 = eval_fpclassify(arg.real_data());
|
||||
@@ -890,7 +890,7 @@ inline std::size_t hash_value(const complex_adaptor<Backend>& val)
|
||||
using boost::multiprecision::backends::complex_adaptor;
|
||||
|
||||
template <class Backend>
|
||||
struct number_category<complex_adaptor<Backend> > : public boost::mpl::int_<boost::multiprecision::number_kind_complex>
|
||||
struct number_category<complex_adaptor<Backend> > : public std::integral_constant<int, boost::multiprecision::number_kind_complex>
|
||||
{};
|
||||
|
||||
template <class Backend, expression_template_option ExpressionTemplates>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <cstdint>
|
||||
#include <boost/multiprecision/number.hpp>
|
||||
#include <boost/math/special_functions/fpclassify.hpp>
|
||||
#include <boost/mpl/list.hpp>
|
||||
#include <boost/container_hash/hash.hpp>
|
||||
|
||||
namespace boost {
|
||||
@@ -27,9 +26,9 @@ namespace concepts {
|
||||
|
||||
struct number_backend_float_architype
|
||||
{
|
||||
typedef mpl::list<boost::long_long_type> signed_types;
|
||||
typedef mpl::list<boost::ulong_long_type> unsigned_types;
|
||||
typedef mpl::list<long double> float_types;
|
||||
typedef std::tuple<boost::long_long_type> signed_types;
|
||||
typedef std::tuple<boost::ulong_long_type> unsigned_types;
|
||||
typedef std::tuple<long double> float_types;
|
||||
typedef int exponent_type;
|
||||
|
||||
number_backend_float_architype()
|
||||
@@ -211,7 +210,7 @@ typedef boost::multiprecision::number<number_backend_float_architype> mp_number_
|
||||
} // namespace concepts
|
||||
|
||||
template <>
|
||||
struct number_category<concepts::number_backend_float_architype> : public mpl::int_<number_kind_floating_point>
|
||||
struct number_category<concepts::number_backend_float_architype> : public std::integral_constant<int, number_kind_floating_point>
|
||||
{};
|
||||
|
||||
}} // namespace boost::multiprecision
|
||||
|
||||
@@ -92,7 +92,7 @@ class cpp_bin_float
|
||||
|
||||
typedef typename rep_type::signed_types signed_types;
|
||||
typedef typename rep_type::unsigned_types unsigned_types;
|
||||
typedef boost::mpl::list<float, double, long double> float_types;
|
||||
typedef std::tuple<float, double, long double> float_types;
|
||||
typedef Exponent exponent_type;
|
||||
|
||||
static const exponent_type max_exponent_limit = boost::integer_traits<exponent_type>::const_max - 2 * static_cast<exponent_type>(bit_count);
|
||||
@@ -324,7 +324,7 @@ class cpp_bin_float
|
||||
return *this;
|
||||
}
|
||||
|
||||
typedef typename mpl::front<unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, unsigned_types>::type ui_type;
|
||||
m_data = static_cast<ui_type>(0u);
|
||||
m_sign = false;
|
||||
m_exponent = 0;
|
||||
@@ -384,7 +384,7 @@ class cpp_bin_float
|
||||
return *this;
|
||||
}
|
||||
|
||||
typedef typename mpl::front<unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, unsigned_types>::type ui_type;
|
||||
m_data = static_cast<ui_type>(0u);
|
||||
m_sign = false;
|
||||
m_exponent = 0;
|
||||
@@ -452,7 +452,7 @@ class cpp_bin_float
|
||||
return *this;
|
||||
}
|
||||
|
||||
typedef typename mpl::front<unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, unsigned_types>::type ui_type;
|
||||
m_data = static_cast<ui_type>(0u);
|
||||
m_sign = false;
|
||||
m_exponent = 0;
|
||||
@@ -1926,7 +1926,7 @@ using backends::digit_base_10;
|
||||
using backends::digit_base_2;
|
||||
|
||||
template <unsigned Digits, backends::digit_base_type DigitBase, class Exponent, Exponent MinE, Exponent MaxE, class Allocator>
|
||||
struct number_category<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> > : public boost::mpl::int_<boost::multiprecision::number_kind_floating_point>
|
||||
struct number_category<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> > : public std::integral_constant<int, boost::multiprecision::number_kind_floating_point>
|
||||
{};
|
||||
|
||||
template <unsigned Digits, backends::digit_base_type DigitBase, class Allocator, class Exponent, Exponent MinE, Exponent MaxE>
|
||||
@@ -1937,7 +1937,7 @@ struct expression_template_default<cpp_bin_float<Digits, DigitBase, Allocator, E
|
||||
|
||||
template <unsigned Digits, backends::digit_base_type DigitBase, class Allocator, class Exponent, Exponent MinE, Exponent MaxE, class Allocator2, class Exponent2, Exponent MinE2, Exponent MaxE2>
|
||||
struct is_equivalent_number_type<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>, cpp_bin_float<Digits, DigitBase, Allocator2, Exponent2, MinE2, MaxE2> >
|
||||
: public mpl::true_ {};
|
||||
: public std::integral_constant<bool, true> {};
|
||||
|
||||
typedef number<backends::cpp_bin_float<50> > cpp_bin_float_50;
|
||||
typedef number<backends::cpp_bin_float<100> > cpp_bin_float_100;
|
||||
@@ -1981,7 +1981,7 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bi
|
||||
if (!value.first)
|
||||
{
|
||||
value.first = true;
|
||||
typedef typename boost::mpl::front<typename number_type::backend_type::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename number_type::backend_type::unsigned_types>::type ui_type;
|
||||
value.second.backend() = ui_type(1u);
|
||||
value.second.backend().exponent() = boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::min_exponent;
|
||||
}
|
||||
@@ -2004,7 +2004,7 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bi
|
||||
using boost::multiprecision::default_ops::eval_decrement;
|
||||
using boost::multiprecision::default_ops::eval_left_shift;
|
||||
typedef typename number_type::backend_type::rep_type int_backend_type;
|
||||
typedef typename boost::mpl::front<typename int_backend_type::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename int_backend_type::unsigned_types>::type ui_type;
|
||||
int_backend_type i;
|
||||
i = ui_type(1u);
|
||||
eval_left_shift(i, boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count - 1);
|
||||
@@ -2036,7 +2036,7 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bi
|
||||
if (!value.first)
|
||||
{
|
||||
// We jump through hoops here just to keep VC12 happy (ie compiler workaround, for very strange compiler bug):
|
||||
typedef typename boost::mpl::front<typename number_type::backend_type::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename number_type::backend_type::unsigned_types>::type ui_type;
|
||||
value.first = true;
|
||||
value.second.backend() = ui_type(1u);
|
||||
value.second = ldexp(value.second, 1 - (int)digits);
|
||||
@@ -2053,7 +2053,7 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_bi
|
||||
{
|
||||
value.first = true;
|
||||
// We jump through hoops here just to keep VC12 happy (ie compiler workaround, for very strange compiler bug):
|
||||
typedef typename boost::mpl::front<typename number_type::backend_type::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename number_type::backend_type::unsigned_types>::type ui_type;
|
||||
value.second.backend() = ui_type(1u);
|
||||
value.second = ldexp(value.second, -1);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class cpp_dec_float;
|
||||
} // namespace backends
|
||||
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
struct number_category<backends::cpp_dec_float<Digits10, ExponentType, Allocator> > : public mpl::int_<number_kind_floating_point>
|
||||
struct number_category<backends::cpp_dec_float<Digits10, ExponentType, Allocator> > : public std::integral_constant<int, number_kind_floating_point>
|
||||
{};
|
||||
|
||||
namespace backends {
|
||||
@@ -72,9 +72,9 @@ class cpp_dec_float
|
||||
static_assert(sizeof(ExponentType) > 1, "ExponentType is too small.");
|
||||
|
||||
public:
|
||||
typedef mpl::list<boost::long_long_type> signed_types;
|
||||
typedef mpl::list<boost::ulong_long_type> unsigned_types;
|
||||
typedef mpl::list<double, long double> float_types;
|
||||
typedef std::tuple<boost::long_long_type> signed_types;
|
||||
typedef std::tuple<boost::ulong_long_type> unsigned_types;
|
||||
typedef std::tuple<double, long double> float_types;
|
||||
typedef ExponentType exponent_type;
|
||||
|
||||
static const std::int32_t cpp_dec_float_radix = 10L;
|
||||
|
||||
@@ -103,7 +103,7 @@ struct is_trivial_cpp_int<cpp_int_base<MinBits, MaxBits, SignType, Checked, Allo
|
||||
//
|
||||
template <unsigned MinBits, unsigned MaxBits, cpp_integer_type SignType, cpp_int_check_type Checked, class Allocator>
|
||||
struct is_unsigned_number<backends::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator> >
|
||||
: public mpl::bool_<(SignType == unsigned_magnitude) || (SignType == unsigned_packed)>
|
||||
: public std::integral_constant<bool, (SignType == unsigned_magnitude) || (SignType == unsigned_packed)>
|
||||
{};
|
||||
|
||||
namespace backends {
|
||||
@@ -128,10 +128,10 @@ struct is_implicit_cpp_int_conversion<cpp_int_backend<MinBits, MaxBits, SignType
|
||||
// Traits class to determine whether operations on a cpp_int may throw:
|
||||
//
|
||||
template <class T>
|
||||
struct is_non_throwing_cpp_int : public mpl::false_
|
||||
struct is_non_throwing_cpp_int : public std::integral_constant<bool, false>
|
||||
{};
|
||||
template <unsigned MinBits, unsigned MaxBits, cpp_integer_type SignType>
|
||||
struct is_non_throwing_cpp_int<cpp_int_backend<MinBits, MaxBits, SignType, unchecked, void> > : public mpl::true_
|
||||
struct is_non_throwing_cpp_int<cpp_int_backend<MinBits, MaxBits, SignType, unchecked, void> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
//
|
||||
@@ -141,27 +141,27 @@ template <class T>
|
||||
struct is_fixed_precision;
|
||||
template <unsigned MinBits, unsigned MaxBits, cpp_integer_type SignType, cpp_int_check_type Checked, class Allocator>
|
||||
struct is_fixed_precision<cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator> >
|
||||
: public mpl::bool_<max_precision<cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator> >::value != UINT_MAX>
|
||||
: public std::integral_constant<bool, max_precision<cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator> >::value != UINT_MAX>
|
||||
{};
|
||||
|
||||
namespace detail {
|
||||
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void verify_new_size(unsigned new_size, unsigned min_size, const mpl::int_<checked>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void verify_new_size(unsigned new_size, unsigned min_size, const std::integral_constant<int, checked>&)
|
||||
{
|
||||
if (new_size < min_size)
|
||||
BOOST_THROW_EXCEPTION(std::overflow_error("Unable to allocate sufficient storage for the value of the result: value overflows the maximum allowable magnitude."));
|
||||
}
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void verify_new_size(unsigned /*new_size*/, unsigned /*min_size*/, const mpl::int_<unchecked>&) {}
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void verify_new_size(unsigned /*new_size*/, unsigned /*min_size*/, const std::integral_constant<int, unchecked>&) {}
|
||||
|
||||
template <class U>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void verify_limb_mask(bool b, U limb, U mask, const mpl::int_<checked>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void verify_limb_mask(bool b, U limb, U mask, const std::integral_constant<int, checked>&)
|
||||
{
|
||||
// When we mask out "limb" with "mask", do we loose bits? If so it's an overflow error:
|
||||
if (b && (limb & ~mask))
|
||||
BOOST_THROW_EXCEPTION(std::overflow_error("Overflow in cpp_int arithmetic: there is insufficient precision in the target type to hold all of the bits of the result."));
|
||||
}
|
||||
template <class U>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void verify_limb_mask(bool /*b*/, U /*limb*/, U /*mask*/, const mpl::int_<unchecked>&) {}
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void verify_limb_mask(bool /*b*/, U /*limb*/, U /*mask*/, const std::integral_constant<int, unchecked>&) {}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -179,7 +179,7 @@ struct cpp_int_base<MinBits, MaxBits, signed_magnitude, Checked, Allocator, fals
|
||||
typedef typename detail::rebind<limb_type, Allocator>::type allocator_type;
|
||||
typedef typename std::allocator_traits<allocator_type>::pointer limb_pointer;
|
||||
typedef typename std::allocator_traits<allocator_type>::const_pointer const_limb_pointer;
|
||||
typedef mpl::int_<Checked> checked_type;
|
||||
typedef std::integral_constant<int, Checked> checked_type;
|
||||
|
||||
//
|
||||
// Interface invariants:
|
||||
@@ -528,7 +528,7 @@ struct cpp_int_base<MinBits, MinBits, signed_magnitude, Checked, void, false>
|
||||
{
|
||||
typedef limb_type* limb_pointer;
|
||||
typedef const limb_type* const_limb_pointer;
|
||||
typedef mpl::int_<Checked> checked_type;
|
||||
typedef std::integral_constant<int, Checked> checked_type;
|
||||
|
||||
struct scoped_shared_storage
|
||||
{
|
||||
@@ -732,7 +732,7 @@ struct cpp_int_base<MinBits, MinBits, unsigned_magnitude, Checked, void, false>
|
||||
{
|
||||
typedef limb_type* limb_pointer;
|
||||
typedef const limb_type* const_limb_pointer;
|
||||
typedef mpl::int_<Checked> checked_type;
|
||||
typedef std::integral_constant<int, Checked> checked_type;
|
||||
|
||||
struct scoped_shared_storage
|
||||
{
|
||||
@@ -886,11 +886,11 @@ struct cpp_int_base<MinBits, MinBits, unsigned_magnitude, Checked, void, false>
|
||||
}
|
||||
|
||||
private:
|
||||
void check_negate(const mpl::int_<checked>&)
|
||||
void check_negate(const std::integral_constant<int, checked>&)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(std::range_error("Attempt to negate an unsigned number."));
|
||||
}
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_negate(const mpl::int_<unchecked>&) {}
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_negate(const std::integral_constant<int, unchecked>&) {}
|
||||
|
||||
public:
|
||||
BOOST_MP_CXX14_CONSTEXPR void negate() BOOST_MP_NOEXCEPT_IF((Checked == unchecked))
|
||||
@@ -961,7 +961,7 @@ struct cpp_int_base<MinBits, MinBits, signed_magnitude, Checked, void, true>
|
||||
typedef typename trivial_limb_type<MinBits>::type local_limb_type;
|
||||
typedef local_limb_type* limb_pointer;
|
||||
typedef const local_limb_type* const_limb_pointer;
|
||||
typedef mpl::int_<Checked> checked_type;
|
||||
typedef std::integral_constant<int, Checked> checked_type;
|
||||
|
||||
struct scoped_shared_storage
|
||||
{
|
||||
@@ -985,7 +985,7 @@ struct cpp_int_base<MinBits, MinBits, signed_magnitude, Checked, void, true>
|
||||
protected:
|
||||
template <class T>
|
||||
BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<!(!boost::multiprecision::detail::is_integral<T>::value || (std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::digits <= (int)MinBits)))>::type
|
||||
check_in_range(T val, const mpl::int_<checked>&)
|
||||
check_in_range(T val, const std::integral_constant<int, checked>&)
|
||||
{
|
||||
typedef typename std::common_type<typename boost::multiprecision::detail::make_unsigned<T>::type, local_limb_type>::type common_type;
|
||||
|
||||
@@ -994,7 +994,7 @@ struct cpp_int_base<MinBits, MinBits, signed_magnitude, Checked, void, true>
|
||||
}
|
||||
template <class T>
|
||||
BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<!(boost::multiprecision::detail::is_integral<T>::value || (std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::digits <= (int)MinBits)))>::type
|
||||
check_in_range(T val, const mpl::int_<checked>&)
|
||||
check_in_range(T val, const std::integral_constant<int, checked>&)
|
||||
{
|
||||
using std::abs;
|
||||
typedef typename std::common_type<T, local_limb_type>::type common_type;
|
||||
@@ -1003,7 +1003,7 @@ struct cpp_int_base<MinBits, MinBits, signed_magnitude, Checked, void, true>
|
||||
BOOST_THROW_EXCEPTION(std::range_error("The argument to a cpp_int constructor exceeded the largest value it can represent."));
|
||||
}
|
||||
template <class T, int C>
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_in_range(T, const mpl::int_<C>&) BOOST_NOEXCEPT {}
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_in_range(T, const std::integral_constant<int, C>&) BOOST_NOEXCEPT {}
|
||||
|
||||
template <class T>
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_in_range(T val) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval<cpp_int_base>().check_in_range(std::declval<T>(), checked_type())))
|
||||
@@ -1140,7 +1140,7 @@ struct cpp_int_base<MinBits, MinBits, unsigned_magnitude, Checked, void, true>
|
||||
|
||||
local_limb_type m_data;
|
||||
|
||||
typedef mpl::int_<Checked> checked_type;
|
||||
typedef std::integral_constant<int, Checked> checked_type;
|
||||
|
||||
//
|
||||
// Interface invariants:
|
||||
@@ -1150,7 +1150,7 @@ struct cpp_int_base<MinBits, MinBits, unsigned_magnitude, Checked, void, true>
|
||||
protected:
|
||||
template <class T>
|
||||
BOOST_MP_CXX14_CONSTEXPR typename std::enable_if< !(std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::digits <= (int)MinBits))>::type
|
||||
check_in_range(T val, const mpl::int_<checked>&, const std::integral_constant<bool, false>&)
|
||||
check_in_range(T val, const std::integral_constant<int, checked>&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
typedef typename std::common_type<T, local_limb_type>::type common_type;
|
||||
|
||||
@@ -1158,7 +1158,7 @@ struct cpp_int_base<MinBits, MinBits, unsigned_magnitude, Checked, void, true>
|
||||
BOOST_THROW_EXCEPTION(std::range_error("The argument to a cpp_int constructor exceeded the largest value it can represent."));
|
||||
}
|
||||
template <class T>
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_in_range(T val, const mpl::int_<checked>&, const std::integral_constant<bool, true>&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_in_range(T val, const std::integral_constant<int, checked>&, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
typedef typename std::common_type<T, local_limb_type>::type common_type;
|
||||
|
||||
@@ -1168,7 +1168,7 @@ struct cpp_int_base<MinBits, MinBits, unsigned_magnitude, Checked, void, true>
|
||||
BOOST_THROW_EXCEPTION(std::range_error("The argument to an unsigned cpp_int constructor was negative."));
|
||||
}
|
||||
template <class T, int C, bool B>
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void check_in_range(T, const mpl::int_<C>&, const std::integral_constant<bool, B>&) BOOST_NOEXCEPT {}
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void check_in_range(T, const std::integral_constant<int, C>&, const std::integral_constant<bool, B>&) BOOST_NOEXCEPT {}
|
||||
|
||||
template <class T>
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void check_in_range(T val) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval<cpp_int_base>().check_in_range(std::declval<T>(), checked_type(), boost::multiprecision::detail::is_signed<T>())))
|
||||
@@ -1292,8 +1292,8 @@ struct is_allowed_cpp_int_base_conversion : public std::conditional<
|
||||
|| std::is_same<Arg, double_limb_type>::value || std::is_same<Arg, signed_double_limb_type>::value
|
||||
#endif
|
||||
|| literals::detail::is_value_pack<Arg>::value || (is_trivial_cpp_int<Base>::value && boost::multiprecision::detail::is_arithmetic<Arg>::value),
|
||||
mpl::true_,
|
||||
mpl::false_>::type
|
||||
std::integral_constant<bool, true>,
|
||||
std::integral_constant<bool, false>>::type
|
||||
{};
|
||||
//
|
||||
// Now the actual backend, normalising parameters passed to the base class:
|
||||
@@ -1317,25 +1317,25 @@ struct cpp_int_backend
|
||||
Allocator,
|
||||
is_trivial_cpp_int<self_type>::value>
|
||||
base_type;
|
||||
typedef mpl::bool_<is_trivial_cpp_int<self_type>::value> trivial_tag;
|
||||
typedef std::integral_constant<bool, is_trivial_cpp_int<self_type>::value> trivial_tag;
|
||||
|
||||
public:
|
||||
typedef typename mpl::if_<
|
||||
trivial_tag,
|
||||
mpl::list<
|
||||
typedef typename std::conditional<
|
||||
is_trivial_cpp_int<self_type>::value,
|
||||
std::tuple<
|
||||
signed char, short, int, long,
|
||||
boost::long_long_type, signed_double_limb_type>,
|
||||
mpl::list<signed_limb_type, signed_double_limb_type> >::type signed_types;
|
||||
typedef typename mpl::if_<
|
||||
trivial_tag,
|
||||
mpl::list<unsigned char, unsigned short, unsigned,
|
||||
std::tuple<signed_limb_type, signed_double_limb_type> >::type signed_types;
|
||||
typedef typename std::conditional<
|
||||
is_trivial_cpp_int<self_type>::value,
|
||||
std::tuple<unsigned char, unsigned short, unsigned,
|
||||
unsigned long, boost::ulong_long_type, double_limb_type>,
|
||||
mpl::list<limb_type, double_limb_type> >::type unsigned_types;
|
||||
typedef typename mpl::if_<
|
||||
trivial_tag,
|
||||
mpl::list<float, double, long double>,
|
||||
mpl::list<long double> >::type float_types;
|
||||
typedef mpl::int_<Checked> checked_type;
|
||||
std::tuple<limb_type, double_limb_type> >::type unsigned_types;
|
||||
typedef typename std::conditional<
|
||||
is_trivial_cpp_int<self_type>::value,
|
||||
std::tuple<float, double, long double>,
|
||||
std::tuple<long double> >::type float_types;
|
||||
typedef std::integral_constant<int, Checked> checked_type;
|
||||
|
||||
BOOST_MP_FORCEINLINE constexpr cpp_int_backend() BOOST_NOEXCEPT {}
|
||||
BOOST_MP_FORCEINLINE constexpr cpp_int_backend(const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF(std::is_void<Allocator>::value) : base_type(o) {}
|
||||
@@ -1367,7 +1367,7 @@ struct cpp_int_backend
|
||||
|
||||
private:
|
||||
template <unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& other, mpl::true_ const&, mpl::true_ const&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& other, std::integral_constant<bool, true> const&, std::integral_constant<bool, true> const&)
|
||||
{
|
||||
// Assigning trivial type to trivial type:
|
||||
this->check_in_range(*other.limbs());
|
||||
@@ -1376,7 +1376,7 @@ struct cpp_int_backend
|
||||
this->normalize();
|
||||
}
|
||||
template <unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& other, mpl::true_ const&, mpl::false_ const&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& other, std::integral_constant<bool, true> const&, std::integral_constant<bool, false> const&)
|
||||
{
|
||||
// non-trivial to trivial narrowing conversion:
|
||||
double_limb_type v = *other.limbs();
|
||||
@@ -1393,7 +1393,7 @@ struct cpp_int_backend
|
||||
this->normalize();
|
||||
}
|
||||
template <unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& other, mpl::false_ const&, mpl::true_ const&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& other, std::integral_constant<bool, false> const&, std::integral_constant<bool, true> const&)
|
||||
{
|
||||
// trivial to non-trivial, treat the trivial argument as if it were an unsigned arithmetic type, then set the sign afterwards:
|
||||
*this = static_cast<
|
||||
@@ -1403,7 +1403,7 @@ struct cpp_int_backend
|
||||
this->sign(other.sign());
|
||||
}
|
||||
template <unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& other, mpl::false_ const&, mpl::false_ const&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& other, std::integral_constant<bool, false> const&, std::integral_constant<bool, false> const&)
|
||||
{
|
||||
// regular non-trivial to non-trivial assign:
|
||||
this->resize(other.size(), other.size());
|
||||
@@ -1437,8 +1437,8 @@ struct cpp_int_backend
|
||||
{
|
||||
do_assign(
|
||||
other,
|
||||
mpl::bool_<is_trivial_cpp_int<self_type>::value>(),
|
||||
mpl::bool_<is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value>());
|
||||
std::integral_constant<bool, is_trivial_cpp_int<self_type>::value>(),
|
||||
std::integral_constant<bool, is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value>());
|
||||
}
|
||||
template <unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
explicit BOOST_MP_CXX14_CONSTEXPR cpp_int_backend(
|
||||
@@ -1448,8 +1448,8 @@ struct cpp_int_backend
|
||||
{
|
||||
do_assign(
|
||||
other,
|
||||
mpl::bool_<is_trivial_cpp_int<self_type>::value>(),
|
||||
mpl::bool_<is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value>());
|
||||
std::integral_constant<bool, is_trivial_cpp_int<self_type>::value>(),
|
||||
std::integral_constant<bool, is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value>());
|
||||
}
|
||||
template <unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_CXX14_CONSTEXPR cpp_int_backend& operator=(
|
||||
@@ -1457,8 +1457,8 @@ struct cpp_int_backend
|
||||
{
|
||||
do_assign(
|
||||
other,
|
||||
mpl::bool_<is_trivial_cpp_int<self_type>::value>(),
|
||||
mpl::bool_<is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value>());
|
||||
std::integral_constant<bool, is_trivial_cpp_int<self_type>::value>(),
|
||||
std::integral_constant<bool, is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value>());
|
||||
return *this;
|
||||
}
|
||||
constexpr cpp_int_backend(const cpp_int_backend& a, const literals::detail::negate_tag& tag)
|
||||
@@ -1484,7 +1484,7 @@ struct cpp_int_backend
|
||||
}
|
||||
private:
|
||||
template <class A>
|
||||
BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<boost::multiprecision::detail::is_unsigned<A>::value>::type do_assign_arithmetic(A val, const mpl::true_&)
|
||||
BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<boost::multiprecision::detail::is_unsigned<A>::value>::type do_assign_arithmetic(A val, const std::integral_constant<bool, true>&)
|
||||
BOOST_MP_NOEXCEPT_IF(noexcept(std::declval<cpp_int_backend>().check_in_range(std::declval<A>())))
|
||||
{
|
||||
this->check_in_range(val);
|
||||
@@ -1493,7 +1493,7 @@ struct cpp_int_backend
|
||||
this->normalize();
|
||||
}
|
||||
template <class A>
|
||||
BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<!(boost::multiprecision::detail::is_unsigned<A>::value || !boost::multiprecision::detail::is_integral<A>::value)>::type do_assign_arithmetic(A val, const mpl::true_&)
|
||||
BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<!(boost::multiprecision::detail::is_unsigned<A>::value || !boost::multiprecision::detail::is_integral<A>::value)>::type do_assign_arithmetic(A val, const std::integral_constant<bool, true>&)
|
||||
BOOST_MP_NOEXCEPT_IF(noexcept(std::declval<cpp_int_backend>().check_in_range(std::declval<A>())) && noexcept(std::declval<cpp_int_backend>().sign(true)))
|
||||
{
|
||||
this->check_in_range(val);
|
||||
@@ -1502,26 +1502,26 @@ struct cpp_int_backend
|
||||
this->normalize();
|
||||
}
|
||||
template <class A>
|
||||
BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<!boost::multiprecision::detail::is_integral<A>::value>::type do_assign_arithmetic(A val, const mpl::true_&)
|
||||
BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<!boost::multiprecision::detail::is_integral<A>::value>::type do_assign_arithmetic(A val, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
this->check_in_range(val);
|
||||
*this->limbs() = (val < 0) ? static_cast<typename self_type::local_limb_type>(boost::multiprecision::detail::abs(val)) : static_cast<typename self_type::local_limb_type>(val);
|
||||
this->sign(val < 0);
|
||||
this->normalize();
|
||||
}
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(limb_type i, const mpl::false_&) BOOST_NOEXCEPT
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(limb_type i, const std::integral_constant<bool, false>&) BOOST_NOEXCEPT
|
||||
{
|
||||
this->resize(1, 1);
|
||||
*this->limbs() = i;
|
||||
this->sign(false);
|
||||
}
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(signed_limb_type i, const mpl::false_&) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval<cpp_int_backend>().sign(true)))
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(signed_limb_type i, const std::integral_constant<bool, false>&) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval<cpp_int_backend>().sign(true)))
|
||||
{
|
||||
this->resize(1, 1);
|
||||
*this->limbs() = static_cast<limb_type>(boost::multiprecision::detail::unsigned_abs(i));
|
||||
this->sign(i < 0);
|
||||
}
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(double_limb_type i, const mpl::false_&) BOOST_NOEXCEPT
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(double_limb_type i, const std::integral_constant<bool, false>&) BOOST_NOEXCEPT
|
||||
{
|
||||
static_assert(sizeof(i) == 2 * sizeof(limb_type), "Failed integer size check");
|
||||
static_assert(base_type::internal_limb_count >= 2, "Failed internal limb count");
|
||||
@@ -1535,7 +1535,7 @@ struct cpp_int_backend
|
||||
this->resize(p[1] ? 2 : 1, p[1] ? 2 : 1);
|
||||
this->sign(false);
|
||||
}
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(signed_double_limb_type i, const mpl::false_&) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval<cpp_int_backend>().sign(true)))
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(signed_double_limb_type i, const std::integral_constant<bool, false>&) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval<cpp_int_backend>().sign(true)))
|
||||
{
|
||||
static_assert(sizeof(i) == 2 * sizeof(limb_type), "double limb type size check failed");
|
||||
static_assert(base_type::internal_limb_count >= 2, "Failed internal limb count check");
|
||||
@@ -1554,7 +1554,7 @@ struct cpp_int_backend
|
||||
this->sign(s);
|
||||
}
|
||||
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(long double a, const mpl::false_&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(long double a, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
using default_ops::eval_add;
|
||||
using default_ops::eval_subtract;
|
||||
@@ -1564,7 +1564,7 @@ struct cpp_int_backend
|
||||
|
||||
if (a < 0)
|
||||
{
|
||||
do_assign_arithmetic(-a, mpl::false_());
|
||||
do_assign_arithmetic(-a, std::integral_constant<bool, false>());
|
||||
this->sign(true);
|
||||
return;
|
||||
}
|
||||
@@ -1620,7 +1620,7 @@ struct cpp_int_backend
|
||||
}
|
||||
|
||||
private:
|
||||
void do_assign_string(const char* s, const mpl::true_&)
|
||||
void do_assign_string(const char* s, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
std::size_t n = s ? std::strlen(s) : 0;
|
||||
*this = 0;
|
||||
@@ -1671,7 +1671,7 @@ struct cpp_int_backend
|
||||
if (isneg)
|
||||
this->negate();
|
||||
}
|
||||
void do_assign_string(const char* s, const mpl::false_&)
|
||||
void do_assign_string(const char* s, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
using default_ops::eval_add;
|
||||
using default_ops::eval_multiply;
|
||||
@@ -1838,7 +1838,7 @@ struct cpp_int_backend
|
||||
}
|
||||
|
||||
private:
|
||||
std::string do_get_trivial_string(std::ios_base::fmtflags f, const mpl::false_&) const
|
||||
std::string do_get_trivial_string(std::ios_base::fmtflags f, const std::integral_constant<bool, false>&) const
|
||||
{
|
||||
typedef typename std::conditional<sizeof(typename base_type::local_limb_type) == 1, unsigned, typename base_type::local_limb_type>::type io_type;
|
||||
if (this->sign() && (((f & std::ios_base::hex) == std::ios_base::hex) || ((f & std::ios_base::oct) == std::ios_base::oct)))
|
||||
@@ -1854,7 +1854,7 @@ struct cpp_int_backend
|
||||
result += ss.str();
|
||||
return result;
|
||||
}
|
||||
std::string do_get_trivial_string(std::ios_base::fmtflags f, const mpl::true_&) const
|
||||
std::string do_get_trivial_string(std::ios_base::fmtflags f, const std::integral_constant<bool, true>&) const
|
||||
{
|
||||
// Even though we have only one limb, we can't do IO on it :-(
|
||||
int base = 10;
|
||||
@@ -1932,15 +1932,15 @@ struct cpp_int_backend
|
||||
}
|
||||
return result;
|
||||
}
|
||||
std::string do_get_string(std::ios_base::fmtflags f, const mpl::true_&) const
|
||||
std::string do_get_string(std::ios_base::fmtflags f, const std::integral_constant<bool, true>&) const
|
||||
{
|
||||
#ifdef BOOST_MP_NO_DOUBLE_LIMB_TYPE_IO
|
||||
return do_get_trivial_string(f, mpl::bool_<std::is_same<typename base_type::local_limb_type, double_limb_type>::value>());
|
||||
return do_get_trivial_string(f, std::integral_constant<bool, std::is_same<typename base_type::local_limb_type, double_limb_type>::value>());
|
||||
#else
|
||||
return do_get_trivial_string(f, mpl::bool_<false>());
|
||||
return do_get_trivial_string(f, std::integral_constant<bool, false>());
|
||||
#endif
|
||||
}
|
||||
std::string do_get_string(std::ios_base::fmtflags f, const mpl::false_&) const
|
||||
std::string do_get_string(std::ios_base::fmtflags f, const std::integral_constant<bool, false>&) const
|
||||
{
|
||||
using default_ops::eval_get_sign;
|
||||
int base = 10;
|
||||
@@ -2047,7 +2047,7 @@ struct cpp_int_backend
|
||||
|
||||
private:
|
||||
template <class Container>
|
||||
void construct_from_container(const Container& c, const mpl::false_&)
|
||||
void construct_from_container(const Container& c, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
//
|
||||
// We assume that c is a sequence of (unsigned) bytes with the most significant byte first:
|
||||
@@ -2075,7 +2075,7 @@ struct cpp_int_backend
|
||||
}
|
||||
}
|
||||
template <class Container>
|
||||
BOOST_MP_CXX14_CONSTEXPR void construct_from_container(const Container& c, const mpl::true_&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void construct_from_container(const Container& c, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
//
|
||||
// We assume that c is a sequence of (unsigned) bytes with the most significant byte first:
|
||||
@@ -2108,7 +2108,7 @@ struct cpp_int_backend
|
||||
construct_from_container(c, trivial_tag());
|
||||
}
|
||||
template <unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o, const mpl::false_&, const mpl::false_&) const BOOST_NOEXCEPT
|
||||
BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o, const std::integral_constant<bool, false>&, const std::integral_constant<bool, false>&) const BOOST_NOEXCEPT
|
||||
{
|
||||
if (this->sign() != o.sign())
|
||||
return this->sign() ? -1 : 1;
|
||||
@@ -2121,19 +2121,19 @@ struct cpp_int_backend
|
||||
return result;
|
||||
}
|
||||
template <unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o, const mpl::true_&, const mpl::false_&) const
|
||||
BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o, const std::integral_constant<bool, true>&, const std::integral_constant<bool, false>&) const
|
||||
{
|
||||
cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> t(*this);
|
||||
return t.compare(o);
|
||||
}
|
||||
template <unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o, const mpl::false_&, const mpl::true_&) const
|
||||
BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o, const std::integral_constant<bool, false>&, const std::integral_constant<bool, true>&) const
|
||||
{
|
||||
cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator> t(o);
|
||||
return compare(t);
|
||||
}
|
||||
template <unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o, const mpl::true_&, const mpl::true_&) const BOOST_NOEXCEPT
|
||||
BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o, const std::integral_constant<bool, true>&, const std::integral_constant<bool, true>&) const BOOST_NOEXCEPT
|
||||
{
|
||||
if (this->sign())
|
||||
{
|
||||
@@ -2154,8 +2154,8 @@ struct cpp_int_backend
|
||||
template <unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_CXX14_CONSTEXPR int compare(const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o) const BOOST_NOEXCEPT
|
||||
{
|
||||
typedef mpl::bool_<is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator> >::value> t1;
|
||||
typedef mpl::bool_<is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value> t2;
|
||||
typedef std::integral_constant<bool, is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator> >::value> t1;
|
||||
typedef std::integral_constant<bool, is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value> t2;
|
||||
return compare_imp(o, t1(), t2());
|
||||
}
|
||||
template <unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
@@ -2210,7 +2210,7 @@ struct double_precision_type<backends::cpp_int_backend<MinBits, MaxBits, SignTyp
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, cpp_integer_type SignType, cpp_int_check_type Checked, class Allocator, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
struct is_equivalent_number_type<backends::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, backends::cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >
|
||||
: public mpl::bool_<std::numeric_limits<number<backends::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, et_on> >::digits == std::numeric_limits<number<backends::cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>, et_on> >::digits>{};
|
||||
: public std::integral_constant<bool, std::numeric_limits<number<backends::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, et_on> >::digits == std::numeric_limits<number<backends::cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>, et_on> >::digits>{};
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, cpp_integer_type SignType, cpp_int_check_type Checked>
|
||||
struct expression_template_default<backends::cpp_int_backend<MinBits, MaxBits, SignType, Checked, void> >
|
||||
@@ -2221,7 +2221,7 @@ struct expression_template_default<backends::cpp_int_backend<MinBits, MaxBits, S
|
||||
using boost::multiprecision::backends::cpp_int_backend;
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, cpp_integer_type SignType, cpp_int_check_type Checked, class Allocator>
|
||||
struct number_category<cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator> > : public mpl::int_<number_kind_integer>
|
||||
struct number_category<cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator> > : public std::integral_constant<int, number_kind_integer>
|
||||
{};
|
||||
|
||||
typedef number<cpp_int_backend<> > cpp_int;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace boost { namespace multiprecision { namespace backends {
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_CXX14_CONSTEXPR void is_valid_bitwise_op(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o, const mpl::int_<checked>&)
|
||||
const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o, const std::integral_constant<int, checked>&)
|
||||
{
|
||||
if (result.sign() || o.sign())
|
||||
BOOST_THROW_EXCEPTION(std::range_error("Bitwise operations on negative values results in undefined behavior."));
|
||||
@@ -27,11 +27,11 @@ BOOST_MP_CXX14_CONSTEXPR void is_valid_bitwise_op(
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_CXX14_CONSTEXPR void is_valid_bitwise_op(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>&,
|
||||
const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>&, const mpl::int_<unchecked>&) {}
|
||||
const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>&, const std::integral_constant<int, unchecked>&) {}
|
||||
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_int_check_type Checked1, class Allocator1>
|
||||
BOOST_MP_CXX14_CONSTEXPR void is_valid_bitwise_op(
|
||||
const cpp_int_backend<MinBits1, MaxBits1, signed_magnitude, Checked1, Allocator1>& result, const mpl::int_<checked>&)
|
||||
const cpp_int_backend<MinBits1, MaxBits1, signed_magnitude, Checked1, Allocator1>& result, const std::integral_constant<int, checked>&)
|
||||
{
|
||||
if (result.sign())
|
||||
BOOST_THROW_EXCEPTION(std::range_error("Bitwise operations on negative values results in undefined behavior."));
|
||||
@@ -39,17 +39,17 @@ BOOST_MP_CXX14_CONSTEXPR void is_valid_bitwise_op(
|
||||
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_int_check_type Checked1, class Allocator1>
|
||||
BOOST_MP_CXX14_CONSTEXPR void is_valid_bitwise_op(
|
||||
const cpp_int_backend<MinBits1, MaxBits1, unsigned_magnitude, Checked1, Allocator1>&, const mpl::int_<checked>&) {}
|
||||
const cpp_int_backend<MinBits1, MaxBits1, unsigned_magnitude, Checked1, Allocator1>&, const std::integral_constant<int, checked>&) {}
|
||||
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
|
||||
BOOST_MP_CXX14_CONSTEXPR void is_valid_bitwise_op(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>&, const mpl::int_<unchecked>&) {}
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>&, const std::integral_constant<int, unchecked>&) {}
|
||||
|
||||
template <class CppInt1, class CppInt2, class Op>
|
||||
BOOST_MP_CXX14_CONSTEXPR void bitwise_op(
|
||||
CppInt1& result,
|
||||
const CppInt2& o,
|
||||
Op op, const mpl::true_&) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<CppInt1>::value))
|
||||
Op op, const std::integral_constant<bool, true>&) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<CppInt1>::value))
|
||||
{
|
||||
//
|
||||
// There are 4 cases:
|
||||
@@ -189,7 +189,7 @@ template <class CppInt1, class CppInt2, class Op>
|
||||
BOOST_MP_CXX14_CONSTEXPR void bitwise_op(
|
||||
CppInt1& result,
|
||||
const CppInt2& o,
|
||||
Op op, const mpl::false_&) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<CppInt1>::value))
|
||||
Op op, const std::integral_constant<bool, false>&) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<CppInt1>::value))
|
||||
{
|
||||
//
|
||||
// Both arguments are unsigned types, very simple case handled as a special case.
|
||||
@@ -234,7 +234,7 @@ eval_bitwise_and(
|
||||
const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
bitwise_op(result, o, bit_and(),
|
||||
mpl::bool_ < std::numeric_limits<number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> > >::is_signed || std::numeric_limits<number<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> > >::is_signed > ());
|
||||
std::integral_constant<bool, std::numeric_limits<number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> > >::is_signed || std::numeric_limits<number<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> > >::is_signed > ());
|
||||
}
|
||||
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
@@ -244,7 +244,7 @@ eval_bitwise_or(
|
||||
const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
bitwise_op(result, o, bit_or(),
|
||||
mpl::bool_ < std::numeric_limits<number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> > >::is_signed || std::numeric_limits<number<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> > >::is_signed > ());
|
||||
std::integral_constant<bool, std::numeric_limits<number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> > >::is_signed || std::numeric_limits<number<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> > >::is_signed > ());
|
||||
}
|
||||
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
@@ -254,7 +254,7 @@ eval_bitwise_xor(
|
||||
const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
bitwise_op(result, o, bit_xor(),
|
||||
mpl::bool_ < std::numeric_limits<number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> > >::is_signed || std::numeric_limits<number<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> > >::is_signed > ());
|
||||
std::integral_constant<bool, std::numeric_limits<number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> > >::is_signed || std::numeric_limits<number<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> > >::is_signed > ());
|
||||
}
|
||||
//
|
||||
// Again for operands which are single limbs:
|
||||
|
||||
@@ -35,7 +35,7 @@ inline void raise_div_overflow()
|
||||
}
|
||||
|
||||
template <class A>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_add_imp(A a, A b, const mpl::true_&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_add_imp(A a, A b, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
if (a > 0)
|
||||
{
|
||||
@@ -50,25 +50,25 @@ inline BOOST_MP_CXX14_CONSTEXPR A checked_add_imp(A a, A b, const mpl::true_&)
|
||||
return a + b;
|
||||
}
|
||||
template <class A>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_add_imp(A a, A b, const mpl::false_&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_add_imp(A a, A b, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
if ((integer_traits<A>::const_max - b) < a)
|
||||
raise_add_overflow();
|
||||
return a + b;
|
||||
}
|
||||
template <class A>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_add(A a, A b, const mpl::int_<checked>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_add(A a, A b, const std::integral_constant<int, checked>&)
|
||||
{
|
||||
return checked_add_imp(a, b, mpl::bool_<boost::multiprecision::detail::is_signed<A>::value && boost::multiprecision::detail::is_integral<A>::value > ());
|
||||
return checked_add_imp(a, b, std::integral_constant<bool, boost::multiprecision::detail::is_signed<A>::value && boost::multiprecision::detail::is_integral<A>::value > ());
|
||||
}
|
||||
template <class A>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_add(A a, A b, const mpl::int_<unchecked>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_add(A a, A b, const std::integral_constant<int, unchecked>&)
|
||||
{
|
||||
return a + b;
|
||||
}
|
||||
|
||||
template <class A>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract_imp(A a, A b, const mpl::true_&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract_imp(A a, A b, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
if (a > 0)
|
||||
{
|
||||
@@ -83,25 +83,25 @@ inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract_imp(A a, A b, const mpl::true
|
||||
return a - b;
|
||||
}
|
||||
template <class A>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract_imp(A a, A b, const mpl::false_&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract_imp(A a, A b, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
if (a < b)
|
||||
raise_subtract_overflow();
|
||||
return a - b;
|
||||
}
|
||||
template <class A>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract(A a, A b, const mpl::int_<checked>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract(A a, A b, const std::integral_constant<int, checked>&)
|
||||
{
|
||||
return checked_subtract_imp(a, b, mpl::bool_<boost::multiprecision::detail::is_signed<A>::value && boost::multiprecision::detail::is_integral<A>::value>());
|
||||
return checked_subtract_imp(a, b, std::integral_constant<bool, boost::multiprecision::detail::is_signed<A>::value && boost::multiprecision::detail::is_integral<A>::value>());
|
||||
}
|
||||
template <class A>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract(A a, A b, const mpl::int_<unchecked>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract(A a, A b, const std::integral_constant<int, unchecked>&)
|
||||
{
|
||||
return a - b;
|
||||
}
|
||||
|
||||
template <class A>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_multiply(A a, A b, const mpl::int_<checked>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_multiply(A a, A b, const std::integral_constant<int, checked>&)
|
||||
{
|
||||
BOOST_MP_USING_ABS
|
||||
if (a && (integer_traits<A>::const_max / abs(a) < abs(b)))
|
||||
@@ -109,26 +109,26 @@ inline BOOST_MP_CXX14_CONSTEXPR A checked_multiply(A a, A b, const mpl::int_<che
|
||||
return a * b;
|
||||
}
|
||||
template <class A>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_multiply(A a, A b, const mpl::int_<unchecked>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_multiply(A a, A b, const std::integral_constant<int, unchecked>&)
|
||||
{
|
||||
return a * b;
|
||||
}
|
||||
|
||||
template <class A>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_divide(A a, A b, const mpl::int_<checked>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_divide(A a, A b, const std::integral_constant<int, checked>&)
|
||||
{
|
||||
if (b == 0)
|
||||
raise_div_overflow();
|
||||
return a / b;
|
||||
}
|
||||
template <class A>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_divide(A a, A b, const mpl::int_<unchecked>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_divide(A a, A b, const std::integral_constant<int, unchecked>&)
|
||||
{
|
||||
return a / b;
|
||||
}
|
||||
|
||||
template <class A>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_left_shift(A a, boost::ulong_long_type shift, const mpl::int_<checked>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_left_shift(A a, boost::ulong_long_type shift, const std::integral_constant<int, checked>&)
|
||||
{
|
||||
if (a && shift)
|
||||
{
|
||||
@@ -138,7 +138,7 @@ inline BOOST_MP_CXX14_CONSTEXPR A checked_left_shift(A a, boost::ulong_long_type
|
||||
return a << shift;
|
||||
}
|
||||
template <class A>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_left_shift(A a, boost::ulong_long_type shift, const mpl::int_<unchecked>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR A checked_left_shift(A a, boost::ulong_long_type shift, const std::integral_constant<int, unchecked>&)
|
||||
{
|
||||
return (shift >= sizeof(A) * CHAR_BIT) ? 0 : a << shift;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace multiprecision {
|
||||
namespace detail {
|
||||
|
||||
template <class Backend, class Unsigned>
|
||||
void assign_bits(Backend& val, Unsigned bits, unsigned bit_location, unsigned chunk_bits, const mpl::false_& tag)
|
||||
void assign_bits(Backend& val, Unsigned bits, unsigned bit_location, unsigned chunk_bits, const std::integral_constant<bool, false>& tag)
|
||||
{
|
||||
unsigned limb = bit_location / (sizeof(limb_type) * CHAR_BIT);
|
||||
unsigned shift = bit_location % (sizeof(limb_type) * CHAR_BIT);
|
||||
@@ -42,7 +42,7 @@ void assign_bits(Backend& val, Unsigned bits, unsigned bit_location, unsigned ch
|
||||
}
|
||||
}
|
||||
template <class Backend, class Unsigned>
|
||||
void assign_bits(Backend& val, Unsigned bits, unsigned bit_location, unsigned chunk_bits, const mpl::true_&)
|
||||
void assign_bits(Backend& val, Unsigned bits, unsigned bit_location, unsigned chunk_bits, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
typedef typename Backend::local_limb_type local_limb_type;
|
||||
//
|
||||
@@ -66,7 +66,7 @@ void assign_bits(Backend& val, Unsigned bits, unsigned bit_location, unsigned ch
|
||||
}
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, cpp_integer_type SignType, cpp_int_check_type Checked, class Allocator>
|
||||
inline void resize_to_bit_size(cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>& newval, unsigned bits, const mpl::false_&)
|
||||
inline void resize_to_bit_size(cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>& newval, unsigned bits, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
unsigned limb_count = static_cast<unsigned>(bits / (sizeof(limb_type) * CHAR_BIT));
|
||||
if (bits % (sizeof(limb_type) * CHAR_BIT))
|
||||
@@ -78,7 +78,7 @@ inline void resize_to_bit_size(cpp_int_backend<MinBits, MaxBits, SignType, Check
|
||||
std::memset(newval.limbs(), 0, newval.size() * sizeof(limb_type));
|
||||
}
|
||||
template <unsigned MinBits, unsigned MaxBits, cpp_integer_type SignType, cpp_int_check_type Checked, class Allocator>
|
||||
inline void resize_to_bit_size(cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>& newval, unsigned, const mpl::true_&)
|
||||
inline void resize_to_bit_size(cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>& newval, unsigned, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
*newval.limbs() = 0;
|
||||
}
|
||||
@@ -177,7 +177,7 @@ import_bits(
|
||||
namespace detail {
|
||||
|
||||
template <class Backend>
|
||||
std::uintmax_t extract_bits(const Backend& val, unsigned location, unsigned count, const mpl::false_& tag)
|
||||
std::uintmax_t extract_bits(const Backend& val, unsigned location, unsigned count, const std::integral_constant<bool, false>& tag)
|
||||
{
|
||||
unsigned limb = location / (sizeof(limb_type) * CHAR_BIT);
|
||||
unsigned shift = location % (sizeof(limb_type) * CHAR_BIT);
|
||||
@@ -194,7 +194,7 @@ std::uintmax_t extract_bits(const Backend& val, unsigned location, unsigned coun
|
||||
}
|
||||
|
||||
template <class Backend>
|
||||
inline std::uintmax_t extract_bits(const Backend& val, unsigned location, unsigned count, const mpl::true_&)
|
||||
inline std::uintmax_t extract_bits(const Backend& val, unsigned location, unsigned count, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
typename Backend::local_limb_type result = *val.limbs();
|
||||
typename Backend::local_limb_type mask = count >= std::numeric_limits<typename Backend::local_limb_type>::digits ? ~static_cast<typename Backend::local_limb_type>(0) : (static_cast<typename Backend::local_limb_type>(1u) << count) - 1;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace detail {
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
inline BOOST_CXX14_CONSTEXPR_IF_DETECTION boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates>
|
||||
get_min(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::true_&)
|
||||
get_min(const std::integral_constant<bool, true>&, const std::integral_constant<bool, true>&, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
// Bounded, signed, and no allocator.
|
||||
typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates> result_type;
|
||||
@@ -37,7 +37,7 @@ get_min(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::tr
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
inline boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates>
|
||||
get_min(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::false_&)
|
||||
get_min(const std::integral_constant<bool, true>&, const std::integral_constant<bool, true>&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
// Bounded, signed, and an allocator (can't be constexpr).
|
||||
typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates> result_type;
|
||||
@@ -48,7 +48,7 @@ get_min(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::fa
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
inline BOOST_CXX14_CONSTEXPR_IF_DETECTION boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates>
|
||||
get_min(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::true_&)
|
||||
get_min(const std::integral_constant<bool, true>&, const std::integral_constant<bool, false>&, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
// Bounded, unsigned, no allocator (can be constexpr):
|
||||
#ifdef BOOST_MP_NO_CONSTEXPR_DETECTION
|
||||
@@ -62,7 +62,7 @@ get_min(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::t
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
inline boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates>
|
||||
get_min(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::false_&)
|
||||
get_min(const std::integral_constant<bool, true>&, const std::integral_constant<bool, false>&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
// Bounded and unsigned with allocator (no constexpr):
|
||||
static const boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates> val(0u);
|
||||
@@ -71,7 +71,7 @@ get_min(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::f
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates, bool has_allocator>
|
||||
inline boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates>
|
||||
get_min(const boost::mpl::false_&, const boost::mpl::true_&, const boost::mpl::bool_<has_allocator>&)
|
||||
get_min(const std::integral_constant<bool, false>&, const std::integral_constant<bool, true>&, const std::integral_constant<bool, has_allocator>&)
|
||||
{
|
||||
// Unbounded and signed, never constexpr because there must be an allocator.
|
||||
// There is no minimum value, just return 0:
|
||||
@@ -81,7 +81,7 @@ get_min(const boost::mpl::false_&, const boost::mpl::true_&, const boost::mpl::b
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates, bool has_allocator>
|
||||
inline boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates>
|
||||
get_min(const boost::mpl::false_&, const boost::mpl::false_&, const boost::mpl::bool_<has_allocator>&)
|
||||
get_min(const std::integral_constant<bool, false>&, const std::integral_constant<bool, false>&, const std::integral_constant<bool, has_allocator>&)
|
||||
{
|
||||
// Unbound and unsigned, never constexpr because there must be an allocator.
|
||||
static const boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates> val(0u);
|
||||
@@ -90,7 +90,7 @@ get_min(const boost::mpl::false_&, const boost::mpl::false_&, const boost::mpl::
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
inline BOOST_CXX14_CONSTEXPR_IF_DETECTION boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates>
|
||||
get_max(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::true_&)
|
||||
get_max(const std::integral_constant<bool, true>&, const std::integral_constant<bool, true>&, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
// Bounded and signed, no allocator, can be constexpr.
|
||||
typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates> result_type;
|
||||
@@ -106,7 +106,7 @@ get_max(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::tr
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
inline boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates>
|
||||
get_max(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::false_&)
|
||||
get_max(const std::integral_constant<bool, true>&, const std::integral_constant<bool, true>&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
// Bounded and signed, has an allocator, never constexpr.
|
||||
typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates> result_type;
|
||||
@@ -117,7 +117,7 @@ get_max(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::fa
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
inline BOOST_CXX14_CONSTEXPR_IF_DETECTION boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates>
|
||||
get_max(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::true_&)
|
||||
get_max(const std::integral_constant<bool, true>&, const std::integral_constant<bool, false>&, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
// Bound and unsigned, no allocator so can be constexpr:
|
||||
typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates> result_type;
|
||||
@@ -133,7 +133,7 @@ get_max(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::t
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
inline boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates>
|
||||
get_max(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::false_&)
|
||||
get_max(const std::integral_constant<bool, true>&, const std::integral_constant<bool, false>&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
// Bound and unsigned, has an allocator so can never be constexpr:
|
||||
typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates> result_type;
|
||||
@@ -144,7 +144,7 @@ get_max(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::f
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates, bool has_allocator>
|
||||
inline boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates>
|
||||
get_max(const boost::mpl::false_&, const boost::mpl::true_&, const boost::mpl::bool_<has_allocator>&)
|
||||
get_max(const std::integral_constant<bool, false>&, const std::integral_constant<bool, true>&, const std::integral_constant<bool, has_allocator>&)
|
||||
{
|
||||
// Unbounded and signed.
|
||||
// There is no maximum value, just return 0:
|
||||
@@ -154,7 +154,7 @@ get_max(const boost::mpl::false_&, const boost::mpl::true_&, const boost::mpl::b
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates, bool has_allocator>
|
||||
inline boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates>
|
||||
get_max(const boost::mpl::false_&, const boost::mpl::false_&, const boost::mpl::bool_<has_allocator>&)
|
||||
get_max(const std::integral_constant<bool, false>&, const std::integral_constant<bool, false>&, const std::integral_constant<bool, has_allocator>&)
|
||||
{
|
||||
// Unbound and unsigned:
|
||||
static const boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ExpressionTemplates> val(0u);
|
||||
@@ -190,12 +190,12 @@ class numeric_limits<boost::multiprecision::number<boost::multiprecision::cpp_in
|
||||
static BOOST_CXX14_CONSTEXPR_IF_DETECTION number_type(min)()
|
||||
{
|
||||
init.do_nothing();
|
||||
return detail::get_min<MinBits, MaxBits, SignType, Checked, Allocator, ExpressionTemplates>(boost::multiprecision::backends::is_fixed_precision<backend_type>(), boost::multiprecision::is_signed_number<backend_type>(), boost::mpl::bool_<std::is_void<Allocator>::value>());
|
||||
return detail::get_min<MinBits, MaxBits, SignType, Checked, Allocator, ExpressionTemplates>(boost::multiprecision::backends::is_fixed_precision<backend_type>(), boost::multiprecision::is_signed_number<backend_type>(), std::integral_constant<bool, std::is_void<Allocator>::value>());
|
||||
}
|
||||
static BOOST_CXX14_CONSTEXPR_IF_DETECTION number_type(max)()
|
||||
{
|
||||
init.do_nothing();
|
||||
return detail::get_max<MinBits, MaxBits, SignType, Checked, Allocator, ExpressionTemplates>(boost::multiprecision::backends::is_fixed_precision<backend_type>(), boost::multiprecision::is_signed_number<backend_type>(), boost::mpl::bool_<std::is_void<Allocator>::value>());
|
||||
return detail::get_max<MinBits, MaxBits, SignType, Checked, Allocator, ExpressionTemplates>(boost::multiprecision::backends::is_fixed_precision<backend_type>(), boost::multiprecision::is_signed_number<backend_type>(), std::integral_constant<bool, std::is_void<Allocator>::value>());
|
||||
}
|
||||
static BOOST_CXX14_CONSTEXPR_IF_DETECTION number_type lowest() { return (min)(); }
|
||||
static constexpr int digits = boost::multiprecision::backends::max_precision<backend_type>::value == UINT_MAX ? INT_MAX : boost::multiprecision::backends::max_precision<backend_type>::value;
|
||||
|
||||
@@ -38,7 +38,7 @@ struct numeric_limits_workaround<R, false>
|
||||
};
|
||||
|
||||
template <class R, class CppInt>
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_in_range(const CppInt& val, const mpl::int_<checked>&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_in_range(const CppInt& val, const std::integral_constant<int, checked>&)
|
||||
{
|
||||
typedef typename boost::multiprecision::detail::canonical<R, CppInt>::type cast_type;
|
||||
|
||||
@@ -56,7 +56,7 @@ BOOST_MP_CXX14_CONSTEXPR void check_in_range(const CppInt& val, const mpl::int_<
|
||||
}
|
||||
}
|
||||
template <class R, class CppInt>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void check_in_range(const CppInt& /*val*/, const mpl::int_<unchecked>&) BOOST_NOEXCEPT {}
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void check_in_range(const CppInt& /*val*/, const std::integral_constant<int, unchecked>&) BOOST_NOEXCEPT {}
|
||||
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void check_is_negative(const std::integral_constant<bool, true>&) BOOST_NOEXCEPT {}
|
||||
inline void check_is_negative(const std::integral_constant<bool, false>&)
|
||||
@@ -79,7 +79,7 @@ template <class R, unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignTy
|
||||
inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<boost::multiprecision::detail::is_integral<R>::value && !is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value, void>::type
|
||||
eval_convert_to(R* result, const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& backend)
|
||||
{
|
||||
typedef mpl::int_<Checked1> checked_type;
|
||||
typedef std::integral_constant<int, Checked1> checked_type;
|
||||
check_in_range<R>(backend, checked_type());
|
||||
|
||||
BOOST_IF_CONSTEXPR(numeric_limits_workaround<R>::digits < cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>::limb_bits)
|
||||
@@ -1111,11 +1111,11 @@ eval_lcm(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& r
|
||||
result.normalize(); // result may overflow the specified number of bits
|
||||
}
|
||||
|
||||
inline void conversion_overflow(const mpl::int_<checked>&)
|
||||
inline void conversion_overflow(const std::integral_constant<int, checked>&)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(std::overflow_error("Overflow in conversion to narrower type"));
|
||||
}
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void conversion_overflow(const mpl::int_<unchecked>&) {}
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void conversion_overflow(const std::integral_constant<int, unchecked>&) {}
|
||||
|
||||
template <class R, unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
|
||||
|
||||
@@ -25,13 +25,13 @@ using namespace boost::multiprecision;
|
||||
using namespace boost::multiprecision::backends;
|
||||
|
||||
template <class T>
|
||||
struct is_binary_archive : public mpl::false_
|
||||
struct is_binary_archive : public std::integral_constant<bool, false>
|
||||
{};
|
||||
template <>
|
||||
struct is_binary_archive<boost::archive::binary_oarchive> : public mpl::true_
|
||||
struct is_binary_archive<boost::archive::binary_oarchive> : public std::integral_constant<bool, true>
|
||||
{};
|
||||
template <>
|
||||
struct is_binary_archive<boost::archive::binary_iarchive> : public mpl::true_
|
||||
struct is_binary_archive<boost::archive::binary_iarchive> : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
//
|
||||
@@ -41,7 +41,7 @@ struct is_binary_archive<boost::archive::binary_iarchive> : public mpl::true_
|
||||
// Binary or not archive.
|
||||
//
|
||||
template <class Archive, class Int>
|
||||
void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::false_ const&, mpl::false_ const&)
|
||||
void do_serialize(Archive& ar, Int& val, std::integral_constant<bool, false> const&, std::integral_constant<bool, false> const&, std::integral_constant<bool, false> const&)
|
||||
{
|
||||
// Load.
|
||||
// Non-trivial.
|
||||
@@ -72,7 +72,7 @@ void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::false_ const&,
|
||||
val.normalize();
|
||||
}
|
||||
template <class Archive, class Int>
|
||||
void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::false_ const&, mpl::false_ const&)
|
||||
void do_serialize(Archive& ar, Int& val, std::integral_constant<bool, true> const&, std::integral_constant<bool, false> const&, std::integral_constant<bool, false> const&)
|
||||
{
|
||||
// Store.
|
||||
// Non-trivial.
|
||||
@@ -97,7 +97,7 @@ void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::false_ const&,
|
||||
}
|
||||
}
|
||||
template <class Archive, class Int>
|
||||
void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::true_ const&, mpl::false_ const&)
|
||||
void do_serialize(Archive& ar, Int& val, std::integral_constant<bool, false> const&, std::integral_constant<bool, true> const&, std::integral_constant<bool, false> const&)
|
||||
{
|
||||
// Load.
|
||||
// Trivial.
|
||||
@@ -119,7 +119,7 @@ void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::true_ const&,
|
||||
val.negate();
|
||||
}
|
||||
template <class Archive, class Int>
|
||||
void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::true_ const&, mpl::false_ const&)
|
||||
void do_serialize(Archive& ar, Int& val, std::integral_constant<bool, true> const&, std::integral_constant<bool, true> const&, std::integral_constant<bool, false> const&)
|
||||
{
|
||||
// Store.
|
||||
// Trivial.
|
||||
@@ -137,7 +137,7 @@ void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::true_ const&, m
|
||||
}
|
||||
}
|
||||
template <class Archive, class Int>
|
||||
void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::false_ const&, mpl::true_ const&)
|
||||
void do_serialize(Archive& ar, Int& val, std::integral_constant<bool, false> const&, std::integral_constant<bool, false> const&, std::integral_constant<bool, true> const&)
|
||||
{
|
||||
// Load.
|
||||
// Non-trivial.
|
||||
@@ -153,7 +153,7 @@ void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::false_ const&,
|
||||
val.normalize();
|
||||
}
|
||||
template <class Archive, class Int>
|
||||
void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::false_ const&, mpl::true_ const&)
|
||||
void do_serialize(Archive& ar, Int& val, std::integral_constant<bool, true> const&, std::integral_constant<bool, false> const&, std::integral_constant<bool, true> const&)
|
||||
{
|
||||
// Store.
|
||||
// Non-trivial.
|
||||
@@ -165,7 +165,7 @@ void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::false_ const&,
|
||||
ar.save_binary(val.limbs(), c * sizeof(limb_type));
|
||||
}
|
||||
template <class Archive, class Int>
|
||||
void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::true_ const&, mpl::true_ const&)
|
||||
void do_serialize(Archive& ar, Int& val, std::integral_constant<bool, false> const&, std::integral_constant<bool, true> const&, std::integral_constant<bool, true> const&)
|
||||
{
|
||||
// Load.
|
||||
// Trivial.
|
||||
@@ -177,7 +177,7 @@ void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::true_ const&,
|
||||
val.negate();
|
||||
}
|
||||
template <class Archive, class Int>
|
||||
void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::true_ const&, mpl::true_ const&)
|
||||
void do_serialize(Archive& ar, Int& val, std::integral_constant<bool, true> const&, std::integral_constant<bool, true> const&, std::integral_constant<bool, true> const&)
|
||||
{
|
||||
// Store.
|
||||
// Trivial.
|
||||
@@ -192,9 +192,10 @@ void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::true_ const&, m
|
||||
template <class Archive, unsigned MinBits, unsigned MaxBits, mp::cpp_integer_type SignType, mp::cpp_int_check_type Checked, class Allocator>
|
||||
void serialize(Archive& ar, mp::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>& val, const unsigned int /*version*/)
|
||||
{
|
||||
typedef typename Archive::is_saving save_tag;
|
||||
typedef mpl::bool_<mp::backends::is_trivial_cpp_int<mp::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator> >::value> trivial_tag;
|
||||
typedef typename cpp_int_detail::is_binary_archive<Archive>::type binary_tag;
|
||||
typedef typename Archive::is_saving archive_save_tag;
|
||||
typedef std::integral_constant<bool, archive_save_tag::value> save_tag;
|
||||
typedef std::integral_constant<bool, mp::backends::is_trivial_cpp_int<mp::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator> >::value> trivial_tag;
|
||||
typedef typename cpp_int_detail::is_binary_archive<Archive>::type binary_tag;
|
||||
|
||||
// Just dispatch to the correct method:
|
||||
cpp_int_detail::do_serialize(ar, val, save_tag(), trivial_tag(), binary_tag());
|
||||
|
||||
@@ -42,13 +42,13 @@ inline BOOST_MP_CXX14_CONSTEXPR unsigned find_msb_default(Unsigned mask)
|
||||
}
|
||||
|
||||
template <class Unsigned>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR unsigned find_lsb(Unsigned mask, const mpl::int_<0>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR unsigned find_lsb(Unsigned mask, const std::integral_constant<int, 0>&)
|
||||
{
|
||||
return find_lsb_default(mask);
|
||||
}
|
||||
|
||||
template <class Unsigned>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask, const mpl::int_<0>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask, const std::integral_constant<int, 0>&)
|
||||
{
|
||||
return find_msb_default(mask);
|
||||
}
|
||||
@@ -57,14 +57,14 @@ inline BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask, const mpl::int_
|
||||
|
||||
#pragma intrinsic(_BitScanForward, _BitScanReverse)
|
||||
|
||||
BOOST_FORCEINLINE unsigned find_lsb(unsigned long mask, const mpl::int_<1>&)
|
||||
BOOST_FORCEINLINE unsigned find_lsb(unsigned long mask, const std::integral_constant<int, 1>&)
|
||||
{
|
||||
unsigned long result;
|
||||
_BitScanForward(&result, mask);
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE unsigned find_msb(unsigned long mask, const mpl::int_<1>&)
|
||||
BOOST_FORCEINLINE unsigned find_msb(unsigned long mask, const std::integral_constant<int, 1>&)
|
||||
{
|
||||
unsigned long result;
|
||||
_BitScanReverse(&result, mask);
|
||||
@@ -74,14 +74,14 @@ BOOST_FORCEINLINE unsigned find_msb(unsigned long mask, const mpl::int_<1>&)
|
||||
|
||||
#pragma intrinsic(_BitScanForward64, _BitScanReverse64)
|
||||
|
||||
BOOST_FORCEINLINE unsigned find_lsb(unsigned __int64 mask, const mpl::int_<2>&)
|
||||
BOOST_FORCEINLINE unsigned find_lsb(unsigned __int64 mask, const std::integral_constant<int, 2>&)
|
||||
{
|
||||
unsigned long result;
|
||||
_BitScanForward64(&result, mask);
|
||||
return result;
|
||||
}
|
||||
template <class Unsigned>
|
||||
BOOST_FORCEINLINE unsigned find_msb(Unsigned mask, const mpl::int_<2>&)
|
||||
BOOST_FORCEINLINE unsigned find_msb(Unsigned mask, const std::integral_constant<int, 2>&)
|
||||
{
|
||||
unsigned long result;
|
||||
_BitScanReverse64(&result, mask);
|
||||
@@ -95,14 +95,14 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_lsb(Unsigned mask)
|
||||
typedef typename boost::multiprecision::detail::make_unsigned<Unsigned>::type ui_type;
|
||||
typedef typename std::conditional<
|
||||
sizeof(Unsigned) <= sizeof(unsigned long),
|
||||
mpl::int_<1>,
|
||||
std::integral_constant<int, 1>,
|
||||
#ifdef _M_X64
|
||||
typename std::conditional<
|
||||
sizeof(Unsigned) <= sizeof(__int64),
|
||||
mpl::int_<2>,
|
||||
mpl::int_<0> >::type
|
||||
std::integral_constant<int, 2>,
|
||||
std::integral_constant<int, 0> >::type
|
||||
#else
|
||||
mpl::int_<0>
|
||||
std::integral_constant<int, 0>
|
||||
#endif
|
||||
>::type tag_type;
|
||||
#ifndef BOOST_MP_NO_CONSTEXPR_DETECTION
|
||||
@@ -121,14 +121,14 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask)
|
||||
typedef typename boost::multiprecision::detail::make_unsigned<Unsigned>::type ui_type;
|
||||
typedef typename std::conditional<
|
||||
sizeof(Unsigned) <= sizeof(unsigned long),
|
||||
mpl::int_<1>,
|
||||
std::integral_constant<int, 1>,
|
||||
#ifdef _M_X64
|
||||
typename std::conditional<
|
||||
sizeof(Unsigned) <= sizeof(__int64),
|
||||
mpl::int_<2>,
|
||||
mpl::int_<0> >::type
|
||||
std::integral_constant<int, 2>,
|
||||
std::integral_constant<int, 0> >::type
|
||||
#else
|
||||
mpl::int_<0>
|
||||
std::integral_constant<int, 0>
|
||||
#endif
|
||||
>::type tag_type;
|
||||
#ifndef BOOST_MP_NO_CONSTEXPR_DETECTION
|
||||
@@ -143,27 +143,27 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask)
|
||||
|
||||
#elif defined(BOOST_GCC) || defined(__clang__) || (defined(BOOST_INTEL) && defined(__GNUC__))
|
||||
|
||||
BOOST_FORCEINLINE unsigned find_lsb(unsigned mask, mpl::int_<1> const&)
|
||||
BOOST_FORCEINLINE unsigned find_lsb(unsigned mask, std::integral_constant<int, 1> const&)
|
||||
{
|
||||
return __builtin_ctz(mask);
|
||||
}
|
||||
BOOST_FORCEINLINE unsigned find_lsb(unsigned long mask, mpl::int_<2> const&)
|
||||
BOOST_FORCEINLINE unsigned find_lsb(unsigned long mask, std::integral_constant<int, 2> const&)
|
||||
{
|
||||
return __builtin_ctzl(mask);
|
||||
}
|
||||
BOOST_FORCEINLINE unsigned find_lsb(boost::ulong_long_type mask, mpl::int_<3> const&)
|
||||
BOOST_FORCEINLINE unsigned find_lsb(boost::ulong_long_type mask, std::integral_constant<int, 3> const&)
|
||||
{
|
||||
return __builtin_ctzll(mask);
|
||||
}
|
||||
BOOST_FORCEINLINE unsigned find_msb(unsigned mask, mpl::int_<1> const&)
|
||||
BOOST_FORCEINLINE unsigned find_msb(unsigned mask, std::integral_constant<int, 1> const&)
|
||||
{
|
||||
return sizeof(unsigned) * CHAR_BIT - 1 - __builtin_clz(mask);
|
||||
}
|
||||
BOOST_FORCEINLINE unsigned find_msb(unsigned long mask, mpl::int_<2> const&)
|
||||
BOOST_FORCEINLINE unsigned find_msb(unsigned long mask, std::integral_constant<int, 2> const&)
|
||||
{
|
||||
return sizeof(unsigned long) * CHAR_BIT - 1 - __builtin_clzl(mask);
|
||||
}
|
||||
BOOST_FORCEINLINE unsigned find_msb(boost::ulong_long_type mask, mpl::int_<3> const&)
|
||||
BOOST_FORCEINLINE unsigned find_msb(boost::ulong_long_type mask, std::integral_constant<int, 3> const&)
|
||||
{
|
||||
return sizeof(boost::ulong_long_type) * CHAR_BIT - 1 - __builtin_clzll(mask);
|
||||
}
|
||||
@@ -171,7 +171,7 @@ BOOST_FORCEINLINE unsigned find_msb(boost::ulong_long_type mask, mpl::int_<3> co
|
||||
|
||||
__extension__ typedef unsigned __int128 uint128_type;
|
||||
|
||||
BOOST_FORCEINLINE unsigned find_msb(uint128_type mask, mpl::int_<0> const&)
|
||||
BOOST_FORCEINLINE unsigned find_msb(uint128_type mask, std::integral_constant<int, 0> const&)
|
||||
{
|
||||
union
|
||||
{
|
||||
@@ -181,15 +181,15 @@ BOOST_FORCEINLINE unsigned find_msb(uint128_type mask, mpl::int_<0> const&)
|
||||
val.v = mask;
|
||||
#if BOOST_ENDIAN_LITTLE_BYTE
|
||||
if (val.sv[1])
|
||||
return find_msb(val.sv[1], mpl::int_<3>()) + 64;
|
||||
return find_msb(val.sv[0], mpl::int_<3>());
|
||||
return find_msb(val.sv[1], std::integral_constant<int, 3>()) + 64;
|
||||
return find_msb(val.sv[0], std::integral_constant<int, 3>());
|
||||
#else
|
||||
if (val.sv[0])
|
||||
return find_msb(val.sv[0], mpl::int_<3>()) + 64;
|
||||
return find_msb(val.sv[1], mpl::int_<3>());
|
||||
return find_msb(val.sv[0], std::integral_constant<int, 3>()) + 64;
|
||||
return find_msb(val.sv[1], std::integral_constant<int, 3>());
|
||||
#endif
|
||||
}
|
||||
BOOST_FORCEINLINE unsigned find_lsb(uint128_type mask, mpl::int_<0> const&)
|
||||
BOOST_FORCEINLINE unsigned find_lsb(uint128_type mask, std::integral_constant<int, 0> const&)
|
||||
{
|
||||
union
|
||||
{
|
||||
@@ -199,12 +199,12 @@ BOOST_FORCEINLINE unsigned find_lsb(uint128_type mask, mpl::int_<0> const&)
|
||||
val.v = mask;
|
||||
#if BOOST_ENDIAN_LITTLE_BYTE
|
||||
if (val.sv[0] == 0)
|
||||
return find_lsb(val.sv[1], mpl::int_<3>()) + 64;
|
||||
return find_lsb(val.sv[0], mpl::int_<3>());
|
||||
return find_lsb(val.sv[1], std::integral_constant<int, 3>()) + 64;
|
||||
return find_lsb(val.sv[0], std::integral_constant<int, 3>());
|
||||
#else
|
||||
if (val.sv[1] == 0)
|
||||
return find_lsb(val.sv[0], mpl::int_<3>()) + 64;
|
||||
return find_lsb(val.sv[1], mpl::int_<3>());
|
||||
return find_lsb(val.sv[0], std::integral_constant<int, 3>()) + 64;
|
||||
return find_lsb(val.sv[1], std::integral_constant<int, 3>());
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -215,14 +215,14 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_lsb(Unsigned mask)
|
||||
typedef typename boost::multiprecision::detail::make_unsigned<Unsigned>::type ui_type;
|
||||
typedef typename std::conditional<
|
||||
sizeof(Unsigned) <= sizeof(unsigned),
|
||||
mpl::int_<1>,
|
||||
std::integral_constant<int, 1>,
|
||||
typename std::conditional<
|
||||
sizeof(Unsigned) <= sizeof(unsigned long),
|
||||
mpl::int_<2>,
|
||||
std::integral_constant<int, 2>,
|
||||
typename std::conditional<
|
||||
sizeof(Unsigned) <= sizeof(boost::ulong_long_type),
|
||||
mpl::int_<3>,
|
||||
mpl::int_<0> >::type>::type>::type tag_type;
|
||||
std::integral_constant<int, 3>,
|
||||
std::integral_constant<int, 0> >::type>::type>::type tag_type;
|
||||
#ifndef BOOST_MP_NO_CONSTEXPR_DETECTION
|
||||
if (BOOST_MP_IS_CONST_EVALUATED(mask))
|
||||
{
|
||||
@@ -238,14 +238,14 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask)
|
||||
typedef typename boost::multiprecision::detail::make_unsigned<Unsigned>::type ui_type;
|
||||
typedef typename std::conditional<
|
||||
sizeof(Unsigned) <= sizeof(unsigned),
|
||||
mpl::int_<1>,
|
||||
std::integral_constant<int, 1>,
|
||||
typename std::conditional<
|
||||
sizeof(Unsigned) <= sizeof(unsigned long),
|
||||
mpl::int_<2>,
|
||||
std::integral_constant<int, 2>,
|
||||
typename std::conditional<
|
||||
sizeof(Unsigned) <= sizeof(boost::ulong_long_type),
|
||||
mpl::int_<3>,
|
||||
mpl::int_<0> >::type>::type>::type tag_type;
|
||||
std::integral_constant<int, 3>,
|
||||
std::integral_constant<int, 0> >::type>::type>::type tag_type;
|
||||
#ifndef BOOST_MP_NO_CONSTEXPR_DETECTION
|
||||
if (BOOST_MP_IS_CONST_EVALUATED(mask))
|
||||
{
|
||||
@@ -256,11 +256,11 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask)
|
||||
return find_msb(static_cast<ui_type>(mask), tag_type());
|
||||
}
|
||||
#elif defined(BOOST_INTEL)
|
||||
BOOST_FORCEINLINE unsigned find_lsb(unsigned mask, mpl::int_<1> const&)
|
||||
BOOST_FORCEINLINE unsigned find_lsb(unsigned mask, std::integral_constant<int, 1> const&)
|
||||
{
|
||||
return _bit_scan_forward(mask);
|
||||
}
|
||||
BOOST_FORCEINLINE unsigned find_msb(unsigned mask, mpl::int_<1> const&)
|
||||
BOOST_FORCEINLINE unsigned find_msb(unsigned mask, std::integral_constant<int, 1> const&)
|
||||
{
|
||||
return _bit_scan_reverse(mask);
|
||||
}
|
||||
@@ -270,8 +270,8 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_lsb(Unsigned mask)
|
||||
typedef typename boost::multiprecision::detail::make_unsigned<Unsigned>::type ui_type;
|
||||
typedef typename std::conditional<
|
||||
sizeof(Unsigned) <= sizeof(unsigned),
|
||||
mpl::int_<1>,
|
||||
mpl::int_<0> >::type tag_type;
|
||||
std::integral_constant<int, 1>,
|
||||
std::integral_constant<int, 0> >::type tag_type;
|
||||
#ifndef BOOST_MP_NO_CONSTEXPR_DETECTION
|
||||
if (BOOST_MP_IS_CONST_EVALUATED(mask))
|
||||
{
|
||||
@@ -287,8 +287,8 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask)
|
||||
typedef typename boost::multiprecision::detail::make_unsigned<Unsigned>::type ui_type;
|
||||
typedef typename std::conditional<
|
||||
sizeof(Unsigned) <= sizeof(unsigned),
|
||||
mpl::int_<1>,
|
||||
mpl::int_<0> >::type tag_type;
|
||||
std::integral_constant<int, 1>,
|
||||
std::integral_constant<int, 0> >::type tag_type;
|
||||
#ifndef BOOST_MP_NO_CONSTEXPR_DETECTION
|
||||
if (BOOST_MP_IS_CONST_EVALUATED(mask))
|
||||
{
|
||||
@@ -302,12 +302,12 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask)
|
||||
template <class Unsigned>
|
||||
BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_lsb(Unsigned mask)
|
||||
{
|
||||
return find_lsb(mask, mpl::int_<0>());
|
||||
return find_lsb(mask, std::integral_constant<int, 0>());
|
||||
}
|
||||
template <class Unsigned>
|
||||
BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask)
|
||||
{
|
||||
return find_msb(mask, mpl::int_<0>());
|
||||
return find_msb(mask, std::integral_constant<int, 0>());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#include <boost/math/special_functions/fpclassify.hpp>
|
||||
#include <boost/math/special_functions/next.hpp>
|
||||
#include <boost/math/special_functions/hypot.hpp>
|
||||
#include <boost/mpl/front.hpp>
|
||||
#include <boost/mpl/fold.hpp>
|
||||
#include <cstdint>
|
||||
#ifndef BOOST_NO_CXX17_HDR_STRING_VIEW
|
||||
#include <string_view>
|
||||
@@ -37,15 +35,15 @@ template <class T>
|
||||
struct is_backend;
|
||||
|
||||
template <class To, class From>
|
||||
void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_floating_point>& /*to_type*/, const mpl::int_<number_kind_integer>& /*from_type*/);
|
||||
void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_floating_point>& /*to_type*/, const std::integral_constant<int, number_kind_integer>& /*from_type*/);
|
||||
template <class To, class From>
|
||||
void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_integer>& /*to_type*/, const mpl::int_<number_kind_integer>& /*from_type*/);
|
||||
void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_integer>& /*to_type*/, const std::integral_constant<int, number_kind_integer>& /*from_type*/);
|
||||
template <class To, class From>
|
||||
void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_floating_point>& /*to_type*/, const mpl::int_<number_kind_floating_point>& /*from_type*/);
|
||||
void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_floating_point>& /*to_type*/, const std::integral_constant<int, number_kind_floating_point>& /*from_type*/);
|
||||
template <class To, class From>
|
||||
void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_rational>& /*to_type*/, const mpl::int_<number_kind_rational>& /*from_type*/);
|
||||
void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_rational>& /*to_type*/, const std::integral_constant<int, number_kind_rational>& /*from_type*/);
|
||||
template <class To, class From>
|
||||
void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_rational>& /*to_type*/, const mpl::int_<number_kind_integer>& /*from_type*/);
|
||||
void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_rational>& /*to_type*/, const std::integral_constant<int, number_kind_integer>& /*from_type*/);
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -786,13 +784,13 @@ inline BOOST_MP_CXX14_CONSTEXPR void eval_bitwise_xor(T& t, const U& u, const V&
|
||||
template <class T>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void eval_increment(T& val)
|
||||
{
|
||||
typedef typename mpl::front<typename T::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type;
|
||||
eval_add(val, static_cast<ui_type>(1u));
|
||||
}
|
||||
template <class T>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void eval_decrement(T& val)
|
||||
{
|
||||
typedef typename mpl::front<typename T::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type;
|
||||
eval_subtract(val, static_cast<ui_type>(1u));
|
||||
}
|
||||
|
||||
@@ -813,18 +811,18 @@ inline BOOST_MP_CXX14_CONSTEXPR void eval_right_shift(T& result, const U& arg, c
|
||||
template <class T>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_is_zero(const T& val)
|
||||
{
|
||||
typedef typename mpl::front<typename T::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type;
|
||||
return val.compare(static_cast<ui_type>(0)) == 0;
|
||||
}
|
||||
template <class T>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR int eval_get_sign(const T& val)
|
||||
{
|
||||
typedef typename mpl::front<typename T::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type;
|
||||
return val.compare(static_cast<ui_type>(0));
|
||||
}
|
||||
|
||||
template <class T, class V, class U>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void assign_components_imp(T& result, const V& v1, const U& v2, const mpl::int_<number_kind_rational>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void assign_components_imp(T& result, const V& v1, const U& v2, const std::integral_constant<int, number_kind_rational>&)
|
||||
{
|
||||
result = v1;
|
||||
T t;
|
||||
@@ -833,7 +831,7 @@ inline BOOST_MP_CXX14_CONSTEXPR void assign_components_imp(T& result, const V& v
|
||||
}
|
||||
|
||||
template <class T, class V, class U, int N>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void assign_components_imp(T& result, const V& v1, const U& v2, const mpl::int_<N>&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void assign_components_imp(T& result, const V& v1, const U& v2, const std::integral_constant<int, N>&)
|
||||
{
|
||||
typedef typename component_type<number<T> >::type component_number_type;
|
||||
|
||||
@@ -868,7 +866,7 @@ template <class R, int b>
|
||||
struct has_enough_bits
|
||||
{
|
||||
template <class T>
|
||||
struct type : public mpl::bool_<!std::is_same<R, T>::value && (std::numeric_limits<T>::digits >= b)>
|
||||
struct type : public std::integral_constant<bool, !std::is_same<R, T>::value && (std::numeric_limits<T>::digits >= b)>
|
||||
{};
|
||||
};
|
||||
|
||||
@@ -886,6 +884,18 @@ struct terminal
|
||||
BOOST_MP_CXX14_CONSTEXPR operator R() const { return value; }
|
||||
};
|
||||
|
||||
template <class Tuple, int i, class T, bool = (i == std::tuple_size<Tuple>::value)>
|
||||
struct find_index_of_type
|
||||
{
|
||||
static constexpr int value = std::is_same<T, typename std::tuple_element<i, Tuple>::type>::value ? i : find_index_of_type<Tuple, i + 1, T>::value;
|
||||
};
|
||||
template <class Tuple, int i, class T>
|
||||
struct find_index_of_type<Tuple, i, T, true>
|
||||
{
|
||||
static constexpr int value = -1;
|
||||
};
|
||||
|
||||
|
||||
template <class R, class B>
|
||||
struct calculate_next_larger_type
|
||||
{
|
||||
@@ -897,25 +907,9 @@ struct calculate_next_larger_type
|
||||
boost::multiprecision::detail::is_unsigned<R>::value,
|
||||
typename B::unsigned_types,
|
||||
typename B::float_types>::type>::type list_type;
|
||||
// A predicate to find a type with enough bits:
|
||||
typedef typename has_enough_bits<R, std::numeric_limits<R>::digits>::template type<mpl::_> pred_type;
|
||||
// See if the last type is in the list, if so we have to start after this:
|
||||
typedef typename mpl::find_if<
|
||||
list_type,
|
||||
std::is_same<R, mpl::_> >::type start_last;
|
||||
// Where we're starting from, either the start of the sequence or the last type found:
|
||||
typedef typename std::conditional<std::is_same<start_last, typename mpl::end<list_type>::type>::value, typename mpl::begin<list_type>::type, start_last>::type start_seq;
|
||||
// The range we're searching:
|
||||
typedef mpl::iterator_range<start_seq, typename mpl::end<list_type>::type> range;
|
||||
// Find the next type:
|
||||
typedef typename mpl::find_if<
|
||||
range,
|
||||
pred_type>::type iter_type;
|
||||
// Either the next type, or a "terminal" to indicate we've run out of types to search:
|
||||
typedef typename mpl::eval_if_c<
|
||||
std::is_same<typename mpl::end<list_type>::type, iter_type>::value,
|
||||
mpl::identity<terminal<R> >,
|
||||
mpl::deref<iter_type> >::type type;
|
||||
static constexpr int start = find_index_of_type<list_type, 0, R>::value;
|
||||
static constexpr int index_of_type = boost::multiprecision::detail::find_index_of_large_enough_type<list_type, start + 1, std::numeric_limits<R>::digits>::value;
|
||||
typedef typename boost::multiprecision::detail::dereference_tuple<index_of_type, list_type, terminal<R> >::type type;
|
||||
};
|
||||
|
||||
template <class R, class T>
|
||||
@@ -961,7 +955,7 @@ inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if< !boost::multiprecision:
|
||||
}
|
||||
|
||||
template <class R, class B>
|
||||
inline void last_chance_eval_convert_to(terminal<R>* result, const B& backend, const mpl::false_&)
|
||||
inline void last_chance_eval_convert_to(terminal<R>* result, const B& backend, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
//
|
||||
// We ran out of types to try for the conversion, try
|
||||
@@ -985,7 +979,7 @@ inline void last_chance_eval_convert_to(terminal<R>* result, const B& backend, c
|
||||
}
|
||||
|
||||
template <class R, class B>
|
||||
inline void last_chance_eval_convert_to(terminal<R>* result, const B& backend, const mpl::true_&)
|
||||
inline void last_chance_eval_convert_to(terminal<R>* result, const B& backend, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
//
|
||||
// We ran out of types to try for the conversion, try
|
||||
@@ -1014,7 +1008,7 @@ inline void last_chance_eval_convert_to(terminal<R>* result, const B& backend, c
|
||||
template <class R, class B>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void eval_convert_to(terminal<R>* result, const B& backend)
|
||||
{
|
||||
typedef mpl::bool_<boost::multiprecision::detail::is_unsigned<R>::value && number_category<B>::value == number_kind_integer> tag_type;
|
||||
typedef std::integral_constant<bool, boost::multiprecision::detail::is_unsigned<R>::value && number_category<B>::value == number_kind_integer> tag_type;
|
||||
last_chance_eval_convert_to(result, backend, tag_type());
|
||||
}
|
||||
|
||||
@@ -1074,7 +1068,7 @@ template <class T, class U>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void eval_abs(T& result, const U& arg)
|
||||
{
|
||||
typedef typename U::signed_types type_list;
|
||||
typedef typename mpl::front<type_list>::type front;
|
||||
typedef typename std::tuple_element<0, type_list>::type front;
|
||||
result = arg;
|
||||
if (arg.compare(front(0)) < 0)
|
||||
result.negate();
|
||||
@@ -1084,7 +1078,7 @@ inline BOOST_MP_CXX14_CONSTEXPR void eval_fabs(T& result, const U& arg)
|
||||
{
|
||||
static_assert(number_category<T>::value == number_kind_floating_point, "The fabs function is only valid for floating point types.");
|
||||
typedef typename U::signed_types type_list;
|
||||
typedef typename mpl::front<type_list>::type front;
|
||||
typedef typename std::tuple_element<0, type_list>::type front;
|
||||
result = arg;
|
||||
if (arg.compare(front(0)) < 0)
|
||||
result.negate();
|
||||
@@ -1811,7 +1805,7 @@ inline BOOST_MP_CXX14_CONSTEXPR void eval_real(To& to, const From& from)
|
||||
template <class To, class From>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void eval_imag(To& to, const From&)
|
||||
{
|
||||
typedef typename mpl::front<typename To::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename To::unsigned_types>::type ui_type;
|
||||
to = ui_type(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ std::string convert_to_string(Backend b, std::streamsize digits, std::ios_base::
|
||||
using default_ops::eval_pow;
|
||||
using default_ops::eval_subtract;
|
||||
|
||||
typedef typename mpl::front<typename Backend::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type;
|
||||
typedef typename Backend::exponent_type exponent_type;
|
||||
|
||||
std::string result;
|
||||
@@ -196,7 +196,7 @@ void convert_from_string(Backend& b, const char* p)
|
||||
using default_ops::eval_multiply;
|
||||
using default_ops::eval_pow;
|
||||
|
||||
typedef typename mpl::front<typename Backend::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type;
|
||||
b = ui_type(0);
|
||||
if (!p || (*p == 0))
|
||||
return;
|
||||
|
||||
@@ -10,7 +10,7 @@ template <class T>
|
||||
void calc_log2(T& num, unsigned digits)
|
||||
{
|
||||
typedef typename boost::multiprecision::detail::canonical<std::uint32_t, T>::type ui_type;
|
||||
typedef typename mpl::front<typename T::signed_types>::type si_type;
|
||||
typedef typename std::tuple_element<0, typename T::signed_types>::type si_type;
|
||||
|
||||
//
|
||||
// String value with 1100 digits:
|
||||
@@ -80,7 +80,7 @@ void calc_log2(T& num, unsigned digits)
|
||||
template <class T>
|
||||
void calc_e(T& result, unsigned digits)
|
||||
{
|
||||
typedef typename mpl::front<typename T::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type;
|
||||
//
|
||||
// 1100 digits in string form:
|
||||
//
|
||||
@@ -129,8 +129,8 @@ void calc_e(T& result, unsigned digits)
|
||||
template <class T>
|
||||
void calc_pi(T& result, unsigned digits)
|
||||
{
|
||||
typedef typename mpl::front<typename T::unsigned_types>::type ui_type;
|
||||
typedef typename mpl::front<typename T::float_types>::type real_type;
|
||||
typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename T::float_types>::type real_type;
|
||||
//
|
||||
// 1100 digits in string form:
|
||||
//
|
||||
@@ -327,7 +327,7 @@ const T& get_constant_one_over_epsilon()
|
||||
if ((digits != boost::multiprecision::detail::digits2<number<T> >::value()))
|
||||
{
|
||||
#endif
|
||||
typedef typename mpl::front<typename T::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type;
|
||||
boost::multiprecision::detail::maybe_promote_precision(&result);
|
||||
result = static_cast<ui_type>(1u);
|
||||
if(std::numeric_limits<number<T> >::is_specialized)
|
||||
|
||||
@@ -102,7 +102,7 @@ void hyp0F0(T& H0F0, const T& x)
|
||||
// http://functions.wolfram.com/HypergeometricFunctions/Hypergeometric0F0/06/01/
|
||||
// There are no checks on input range or parameter boundaries.
|
||||
|
||||
typedef typename mpl::front<typename T::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type;
|
||||
|
||||
BOOST_ASSERT(&H0F0 != &x);
|
||||
long tol = boost::multiprecision::detail::digits2<number<T, et_on> >::value();
|
||||
@@ -350,7 +350,7 @@ void eval_log(T& result, const T& arg)
|
||||
typedef typename boost::multiprecision::detail::canonical<unsigned, T>::type ui_type;
|
||||
typedef typename T::exponent_type exp_type;
|
||||
typedef typename boost::multiprecision::detail::canonical<exp_type, T>::type canonical_exp_type;
|
||||
typedef typename mpl::front<typename T::float_types>::type fp_type;
|
||||
typedef typename std::tuple_element<0, typename T::float_types>::type fp_type;
|
||||
int s = eval_signbit(arg);
|
||||
switch (eval_fpclassify(arg))
|
||||
{
|
||||
@@ -471,7 +471,7 @@ inline void eval_pow(T& result, const T& x, const T& a)
|
||||
{
|
||||
static_assert(number_category<T>::value == number_kind_floating_point, "The pow function is only valid for floating point types.");
|
||||
typedef typename boost::multiprecision::detail::canonical<int, T>::type si_type;
|
||||
typedef typename mpl::front<typename T::float_types>::type fp_type;
|
||||
typedef typename std::tuple_element<0, typename T::float_types>::type fp_type;
|
||||
|
||||
if ((&result == &x) || (&result == &a))
|
||||
{
|
||||
@@ -761,7 +761,7 @@ void eval_exp2(T& result, const T& arg)
|
||||
eval_convert_to(&i, temp);
|
||||
if (arg.compare(i) == 0)
|
||||
{
|
||||
temp = static_cast<typename mpl::front<typename T::unsigned_types>::type>(1u);
|
||||
temp = static_cast<typename std::tuple_element<0, typename T::unsigned_types>::type>(1u);
|
||||
eval_ldexp(result, temp, i);
|
||||
return;
|
||||
}
|
||||
@@ -774,7 +774,7 @@ void eval_exp2(T& result, const T& arg)
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
|
||||
temp = static_cast<typename mpl::front<typename T::unsigned_types>::type>(2u);
|
||||
temp = static_cast<typename std::tuple_element<0, typename T::unsigned_types>::type>(2u);
|
||||
eval_pow(result, temp, arg);
|
||||
}
|
||||
|
||||
@@ -811,7 +811,7 @@ template <class T>
|
||||
void sinhcosh(const T& x, T* p_sinh, T* p_cosh)
|
||||
{
|
||||
typedef typename boost::multiprecision::detail::canonical<unsigned, T>::type ui_type;
|
||||
typedef typename mpl::front<typename T::float_types>::type fp_type;
|
||||
typedef typename std::tuple_element<0, typename T::float_types>::type fp_type;
|
||||
|
||||
switch (eval_fpclassify(x))
|
||||
{
|
||||
@@ -896,7 +896,7 @@ inline void eval_tanh(T& result, const T& x)
|
||||
if ((eval_fpclassify(result) == FP_INFINITE) && (eval_fpclassify(c) == FP_INFINITE))
|
||||
{
|
||||
bool s = eval_signbit(result) != eval_signbit(c);
|
||||
result = static_cast<typename mpl::front<typename T::unsigned_types>::type>(1u);
|
||||
result = static_cast<typename std::tuple_element<0, typename T::unsigned_types>::type>(1u);
|
||||
if (s)
|
||||
result.negate();
|
||||
return;
|
||||
|
||||
@@ -164,7 +164,7 @@ void eval_sin(T& result, const T& x)
|
||||
|
||||
typedef typename boost::multiprecision::detail::canonical<std::int32_t, T>::type si_type;
|
||||
typedef typename boost::multiprecision::detail::canonical<std::uint32_t, T>::type ui_type;
|
||||
typedef typename mpl::front<typename T::float_types>::type fp_type;
|
||||
typedef typename std::tuple_element<0, typename T::float_types>::type fp_type;
|
||||
|
||||
switch (eval_fpclassify(x))
|
||||
{
|
||||
@@ -563,7 +563,7 @@ void eval_asin(T& result, const T& x)
|
||||
{
|
||||
static_assert(number_category<T>::value == number_kind_floating_point, "The asin function is only valid for floating point types.");
|
||||
typedef typename boost::multiprecision::detail::canonical<std::uint32_t, T>::type ui_type;
|
||||
typedef typename mpl::front<typename T::float_types>::type fp_type;
|
||||
typedef typename std::tuple_element<0, typename T::float_types>::type fp_type;
|
||||
|
||||
if (&result == &x)
|
||||
{
|
||||
@@ -736,7 +736,7 @@ inline void eval_acos(T& result, const T& x)
|
||||
return;
|
||||
}
|
||||
|
||||
typedef typename mpl::front<typename T::float_types>::type fp_type;
|
||||
typedef typename std::tuple_element<0, typename T::float_types>::type fp_type;
|
||||
|
||||
if (xx.compare(fp_type(1e-3)) < 0)
|
||||
{
|
||||
@@ -820,7 +820,7 @@ void eval_atan(T& result, const T& x)
|
||||
static_assert(number_category<T>::value == number_kind_floating_point, "The atan function is only valid for floating point types.");
|
||||
typedef typename boost::multiprecision::detail::canonical<std::int32_t, T>::type si_type;
|
||||
typedef typename boost::multiprecision::detail::canonical<std::uint32_t, T>::type ui_type;
|
||||
typedef typename mpl::front<typename T::float_types>::type fp_type;
|
||||
typedef typename std::tuple_element<0, typename T::float_types>::type fp_type;
|
||||
|
||||
switch (eval_fpclassify(x))
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ inline To do_cast(const number<B, et>& from)
|
||||
}
|
||||
|
||||
template <class To, class From>
|
||||
void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_floating_point>& /*to_type*/, const mpl::int_<number_kind_integer>& /*from_type*/)
|
||||
void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_floating_point>& /*to_type*/, const std::integral_constant<int, number_kind_integer>& /*from_type*/)
|
||||
{
|
||||
using default_ops::eval_add;
|
||||
using default_ops::eval_bitwise_and;
|
||||
@@ -75,7 +75,7 @@ void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_
|
||||
}
|
||||
|
||||
template <class To, class From>
|
||||
void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_integer>& /*to_type*/, const mpl::int_<number_kind_integer>& /*from_type*/)
|
||||
void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_integer>& /*to_type*/, const std::integral_constant<int, number_kind_integer>& /*from_type*/)
|
||||
{
|
||||
using default_ops::eval_bitwise_and;
|
||||
using default_ops::eval_bitwise_or;
|
||||
@@ -123,7 +123,7 @@ void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_
|
||||
}
|
||||
|
||||
template <class To, class From>
|
||||
void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_floating_point>& /*to_type*/, const mpl::int_<number_kind_floating_point>& /*from_type*/)
|
||||
void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_floating_point>& /*to_type*/, const std::integral_constant<int, number_kind_floating_point>& /*from_type*/)
|
||||
{
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
@@ -214,7 +214,7 @@ void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_
|
||||
}
|
||||
|
||||
template <class To, class From>
|
||||
void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_rational>& /*to_type*/, const mpl::int_<number_kind_rational>& /*from_type*/)
|
||||
void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_rational>& /*to_type*/, const std::integral_constant<int, number_kind_rational>& /*from_type*/)
|
||||
{
|
||||
typedef typename component_type<number<To> >::type to_component_type;
|
||||
|
||||
@@ -225,7 +225,7 @@ void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_
|
||||
}
|
||||
|
||||
template <class To, class From>
|
||||
void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_rational>& /*to_type*/, const mpl::int_<number_kind_integer>& /*from_type*/)
|
||||
void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_rational>& /*to_type*/, const std::integral_constant<int, number_kind_integer>& /*from_type*/)
|
||||
{
|
||||
typedef typename component_type<number<To> >::type to_component_type;
|
||||
|
||||
@@ -273,7 +273,7 @@ R safe_convert_to_float(const LargeInteger& i)
|
||||
|
||||
template <class To, class Integer>
|
||||
inline typename std::enable_if<!(is_number<To>::value || std::is_floating_point<To>::value)>::type
|
||||
generic_convert_rational_to_float_imp(To& result, const Integer& n, const Integer& d, const mpl::true_&)
|
||||
generic_convert_rational_to_float_imp(To& result, const Integer& n, const Integer& d, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
//
|
||||
// If we get here, then there's something about one type or the other
|
||||
@@ -286,7 +286,7 @@ generic_convert_rational_to_float_imp(To& result, const Integer& n, const Intege
|
||||
}
|
||||
template <class To, class Integer>
|
||||
inline typename std::enable_if<is_number<To>::value || std::is_floating_point<To>::value>::type
|
||||
generic_convert_rational_to_float_imp(To& result, const Integer& n, const Integer& d, const mpl::true_&)
|
||||
generic_convert_rational_to_float_imp(To& result, const Integer& n, const Integer& d, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
//
|
||||
// If we get here, then there's something about one type or the other
|
||||
@@ -300,7 +300,7 @@ generic_convert_rational_to_float_imp(To& result, const Integer& n, const Intege
|
||||
|
||||
template <class To, class Integer>
|
||||
typename std::enable_if<is_number<To>::value || std::is_floating_point<To>::value>::type
|
||||
generic_convert_rational_to_float_imp(To& result, Integer& num, Integer& denom, const mpl::false_&)
|
||||
generic_convert_rational_to_float_imp(To& result, Integer& num, Integer& denom, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
//
|
||||
// If we get here, then the precision of type To is known, and the integer type is unbounded
|
||||
@@ -361,7 +361,7 @@ generic_convert_rational_to_float_imp(To& result, Integer& num, Integer& denom,
|
||||
}
|
||||
template <class To, class Integer>
|
||||
inline typename std::enable_if<!(is_number<To>::value || std::is_floating_point<To>::value)>::type
|
||||
generic_convert_rational_to_float_imp(To& result, Integer& num, Integer& denom, const mpl::false_& tag)
|
||||
generic_convert_rational_to_float_imp(To& result, Integer& num, Integer& denom, const std::integral_constant<bool, false>& tag)
|
||||
{
|
||||
number<To> t;
|
||||
generic_convert_rational_to_float_imp(t, num, denom, tag);
|
||||
@@ -381,22 +381,22 @@ inline void generic_convert_rational_to_float(To& result, const From& f)
|
||||
typedef typename std::conditional<is_number<From>::value, From, number<From> >::type actual_from_type;
|
||||
typedef typename std::conditional<is_number<To>::value || std::is_floating_point<To>::value, To, number<To> >::type actual_to_type;
|
||||
typedef typename component_type<actual_from_type>::type integer_type;
|
||||
typedef mpl::bool_<!std::numeric_limits<integer_type>::is_specialized || std::numeric_limits<integer_type>::is_bounded || !std::numeric_limits<actual_to_type>::is_specialized || !std::numeric_limits<actual_to_type>::is_bounded || (std::numeric_limits<actual_to_type>::radix != 2)> dispatch_tag;
|
||||
typedef std::integral_constant<bool, !std::numeric_limits<integer_type>::is_specialized || std::numeric_limits<integer_type>::is_bounded || !std::numeric_limits<actual_to_type>::is_specialized || !std::numeric_limits<actual_to_type>::is_bounded || (std::numeric_limits<actual_to_type>::radix != 2)> dispatch_tag;
|
||||
|
||||
integer_type n(numerator(static_cast<actual_from_type>(f))), d(denominator(static_cast<actual_from_type>(f)));
|
||||
generic_convert_rational_to_float_imp(result, n, d, dispatch_tag());
|
||||
}
|
||||
|
||||
template <class To, class From>
|
||||
inline void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_floating_point>& /*to_type*/, const mpl::int_<number_kind_rational>& /*from_type*/)
|
||||
inline void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_floating_point>& /*to_type*/, const std::integral_constant<int, number_kind_rational>& /*from_type*/)
|
||||
{
|
||||
generic_convert_rational_to_float(to, from);
|
||||
}
|
||||
|
||||
template <class To, class From>
|
||||
void generic_interconvert_float2rational(To& to, const From& from, const mpl::int_<2>& /*radix*/)
|
||||
void generic_interconvert_float2rational(To& to, const From& from, const std::integral_constant<int, 2>& /*radix*/)
|
||||
{
|
||||
typedef typename mpl::front<typename To::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename To::unsigned_types>::type ui_type;
|
||||
static const int shift = std::numeric_limits<boost::long_long_type>::digits;
|
||||
typename From::exponent_type e;
|
||||
typename component_type<number<To> >::type num, denom;
|
||||
@@ -420,14 +420,14 @@ void generic_interconvert_float2rational(To& to, const From& from, const mpl::in
|
||||
}
|
||||
|
||||
template <class To, class From, int Radix>
|
||||
void generic_interconvert_float2rational(To& to, const From& from, const mpl::int_<Radix>& /*radix*/)
|
||||
void generic_interconvert_float2rational(To& to, const From& from, const std::integral_constant<int, Radix>& /*radix*/)
|
||||
{
|
||||
//
|
||||
// This is almost the same as the binary case above, but we have to use
|
||||
// scalbn and ilogb rather than ldexp and frexp, we also only extract
|
||||
// one Radix digit at a time which is terribly inefficient!
|
||||
//
|
||||
typedef typename mpl::front<typename To::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename To::unsigned_types>::type ui_type;
|
||||
typename From::exponent_type e;
|
||||
typename component_type<number<To> >::type num, denom;
|
||||
number<From> val(from);
|
||||
@@ -461,13 +461,13 @@ void generic_interconvert_float2rational(To& to, const From& from, const mpl::in
|
||||
}
|
||||
|
||||
template <class To, class From>
|
||||
void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_rational>& /*to_type*/, const mpl::int_<number_kind_floating_point>& /*from_type*/)
|
||||
void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_rational>& /*to_type*/, const std::integral_constant<int, number_kind_floating_point>& /*from_type*/)
|
||||
{
|
||||
generic_interconvert_float2rational(to, from, mpl::int_<std::numeric_limits<number<From> >::radix>());
|
||||
generic_interconvert_float2rational(to, from, std::integral_constant<int, std::numeric_limits<number<From> >::radix>());
|
||||
}
|
||||
|
||||
template <class To, class From>
|
||||
void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_integer>& /*to_type*/, const mpl::int_<number_kind_rational>& /*from_type*/)
|
||||
void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_integer>& /*to_type*/, const std::integral_constant<int, number_kind_rational>& /*from_type*/)
|
||||
{
|
||||
number<From> t(from);
|
||||
number<To> result(numerator(t) / denominator(t));
|
||||
@@ -475,7 +475,7 @@ void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_
|
||||
}
|
||||
|
||||
template <class To, class From>
|
||||
void generic_interconvert_float2int(To& to, const From& from, const mpl::int_<2>& /*radix*/)
|
||||
void generic_interconvert_float2int(To& to, const From& from, const std::integral_constant<int, 2>& /*radix*/)
|
||||
{
|
||||
typedef typename From::exponent_type exponent_type;
|
||||
static const exponent_type shift = std::numeric_limits<boost::long_long_type>::digits;
|
||||
@@ -505,7 +505,7 @@ void generic_interconvert_float2int(To& to, const From& from, const mpl::int_<2>
|
||||
}
|
||||
|
||||
template <class To, class From, int Radix>
|
||||
void generic_interconvert_float2int(To& to, const From& from, const mpl::int_<Radix>& /*radix*/)
|
||||
void generic_interconvert_float2int(To& to, const From& from, const std::integral_constant<int, Radix>& /*radix*/)
|
||||
{
|
||||
//
|
||||
// This is almost the same as the binary case above, but we have to use
|
||||
@@ -530,13 +530,13 @@ void generic_interconvert_float2int(To& to, const From& from, const mpl::int_<Ra
|
||||
}
|
||||
|
||||
template <class To, class From>
|
||||
void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_integer>& /*to_type*/, const mpl::int_<number_kind_floating_point>& /*from_type*/)
|
||||
void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_integer>& /*to_type*/, const std::integral_constant<int, number_kind_floating_point>& /*from_type*/)
|
||||
{
|
||||
generic_interconvert_float2int(to, from, mpl::int_<std::numeric_limits<number<From> >::radix>());
|
||||
generic_interconvert_float2int(to, from, std::integral_constant<int, std::numeric_limits<number<From> >::radix>());
|
||||
}
|
||||
|
||||
template <class To, class From, class tag>
|
||||
void generic_interconvert_complex_to_scalar(To& to, const From& from, const mpl::true_&, const tag&)
|
||||
void generic_interconvert_complex_to_scalar(To& to, const From& from, const std::integral_constant<bool, true>&, const tag&)
|
||||
{
|
||||
// We just want the real part, and "to" is the correct type already:
|
||||
eval_real(to, from);
|
||||
@@ -547,7 +547,7 @@ void generic_interconvert_complex_to_scalar(To& to, const From& from, const mpl:
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Could not convert imaginary number to scalar."));
|
||||
}
|
||||
template <class To, class From>
|
||||
void generic_interconvert_complex_to_scalar(To& to, const From& from, const mpl::false_&, const mpl::true_&)
|
||||
void generic_interconvert_complex_to_scalar(To& to, const From& from, const std::integral_constant<bool, false>&, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
typedef typename component_type<number<From> >::type component_number;
|
||||
typedef typename component_number::backend_type component_backend;
|
||||
@@ -555,11 +555,11 @@ void generic_interconvert_complex_to_scalar(To& to, const From& from, const mpl:
|
||||
// Get the real part and copy-construct the result from it:
|
||||
//
|
||||
component_backend r;
|
||||
generic_interconvert_complex_to_scalar(r, from, mpl::true_(), mpl::true_());
|
||||
generic_interconvert_complex_to_scalar(r, from, std::integral_constant<bool, true>(), std::integral_constant<bool, true>());
|
||||
to = r;
|
||||
}
|
||||
template <class To, class From>
|
||||
void generic_interconvert_complex_to_scalar(To& to, const From& from, const mpl::false_&, const mpl::false_&)
|
||||
void generic_interconvert_complex_to_scalar(To& to, const From& from, const std::integral_constant<bool, false>&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
typedef typename component_type<number<From> >::type component_number;
|
||||
typedef typename component_number::backend_type component_backend;
|
||||
@@ -567,25 +567,25 @@ void generic_interconvert_complex_to_scalar(To& to, const From& from, const mpl:
|
||||
// Get the real part and use a generic_interconvert to type To:
|
||||
//
|
||||
component_backend r;
|
||||
generic_interconvert_complex_to_scalar(r, from, mpl::true_(), mpl::true_());
|
||||
generic_interconvert(to, r, mpl::int_<number_category<To>::value>(), mpl::int_<number_category<To>::value>());
|
||||
generic_interconvert_complex_to_scalar(r, from, std::integral_constant<bool, true>(), std::integral_constant<bool, true>());
|
||||
generic_interconvert(to, r, std::integral_constant<int, number_category<To>::value>(), std::integral_constant<int, number_category<To>::value>());
|
||||
}
|
||||
|
||||
template <class To, class From>
|
||||
void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_floating_point>& /*to_type*/, const mpl::int_<number_kind_complex>& /*from_type*/)
|
||||
void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_floating_point>& /*to_type*/, const std::integral_constant<int, number_kind_complex>& /*from_type*/)
|
||||
{
|
||||
typedef typename component_type<number<From> >::type component_number;
|
||||
typedef typename component_number::backend_type component_backend;
|
||||
|
||||
generic_interconvert_complex_to_scalar(to, from, mpl::bool_<std::is_same<component_backend, To>::value>(), mpl::bool_<std::is_constructible<To, const component_backend&>::value>());
|
||||
generic_interconvert_complex_to_scalar(to, from, std::integral_constant<bool, std::is_same<component_backend, To>::value>(), std::integral_constant<bool, std::is_constructible<To, const component_backend&>::value>());
|
||||
}
|
||||
template <class To, class From>
|
||||
void generic_interconvert(To& to, const From& from, const mpl::int_<number_kind_integer>& /*to_type*/, const mpl::int_<number_kind_complex>& /*from_type*/)
|
||||
void generic_interconvert(To& to, const From& from, const std::integral_constant<int, number_kind_integer>& /*to_type*/, const std::integral_constant<int, number_kind_complex>& /*from_type*/)
|
||||
{
|
||||
typedef typename component_type<number<From> >::type component_number;
|
||||
typedef typename component_number::backend_type component_backend;
|
||||
|
||||
generic_interconvert_complex_to_scalar(to, from, mpl::bool_<std::is_same<component_backend, To>::value>(), mpl::bool_<std::is_constructible<To, const component_backend&>::value>());
|
||||
generic_interconvert_complex_to_scalar(to, from, std::integral_constant<bool, std::is_same<component_backend, To>::value>(), std::integral_constant<bool, std::is_constructible<To, const component_backend&>::value>());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ inline BOOST_MP_CXX14_CONSTEXPR void eval_gcd(B& result, const B& a, const B& b)
|
||||
template <class B>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void eval_lcm(B& result, const B& a, const B& b)
|
||||
{
|
||||
typedef typename mpl::front<typename B::unsigned_types>::type ui_type;
|
||||
typedef typename std::tuple_element<0, typename B::unsigned_types>::type ui_type;
|
||||
B t;
|
||||
eval_gcd(t, a, b);
|
||||
|
||||
@@ -272,7 +272,7 @@ struct double_precision_type
|
||||
// check the value is positive:
|
||||
//
|
||||
template <class Backend>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void check_sign_of_backend(const Backend& v, const mpl::true_)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void check_sign_of_backend(const Backend& v, const std::integral_constant<bool, true>)
|
||||
{
|
||||
if (eval_get_sign(v) < 0)
|
||||
{
|
||||
@@ -280,7 +280,7 @@ inline BOOST_MP_CXX14_CONSTEXPR void check_sign_of_backend(const Backend& v, con
|
||||
}
|
||||
}
|
||||
template <class Backend>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void check_sign_of_backend(const Backend&, const mpl::false_) {}
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void check_sign_of_backend(const Backend&, const std::integral_constant<bool, false>) {}
|
||||
//
|
||||
// Calculate (a^p)%c:
|
||||
//
|
||||
@@ -296,7 +296,7 @@ BOOST_MP_CXX14_CONSTEXPR void eval_powm(Backend& result, const Backend& a, const
|
||||
typedef typename double_precision_type<Backend>::type double_type;
|
||||
typedef typename boost::multiprecision::detail::canonical<unsigned char, double_type>::type ui_type;
|
||||
|
||||
check_sign_of_backend(p, mpl::bool_<std::numeric_limits<number<Backend> >::is_signed>());
|
||||
check_sign_of_backend(p, std::integral_constant<bool, std::numeric_limits<number<Backend> >::is_signed>());
|
||||
|
||||
double_type x, y(a), b(p), t;
|
||||
x = ui_type(1u);
|
||||
@@ -330,7 +330,7 @@ BOOST_MP_CXX14_CONSTEXPR void eval_powm(Backend& result, const Backend& a, const
|
||||
using default_ops::eval_multiply;
|
||||
using default_ops::eval_right_shift;
|
||||
|
||||
check_sign_of_backend(p, mpl::bool_<std::numeric_limits<number<Backend> >::is_signed>());
|
||||
check_sign_of_backend(p, std::integral_constant<bool, std::numeric_limits<number<Backend> >::is_signed>());
|
||||
|
||||
if (eval_get_sign(p) < 0)
|
||||
{
|
||||
|
||||
@@ -292,7 +292,7 @@ namespace boost {
|
||||
{
|
||||
number<B, et_off> result(a);
|
||||
using default_ops::eval_left_shift;
|
||||
detail::check_shift_range(b, mpl::bool_<(sizeof(I) > sizeof(std::size_t))>(), mpl::bool_<boost::multiprecision::detail::is_signed<I>::value>());
|
||||
detail::check_shift_range(b, std::integral_constant<bool, (sizeof(I) > sizeof(std::size_t))>(), std::integral_constant<bool, boost::multiprecision::detail::is_signed<I>::value>());
|
||||
eval_left_shift(result.backend(), b);
|
||||
return result;
|
||||
}
|
||||
@@ -302,7 +302,7 @@ namespace boost {
|
||||
{
|
||||
number<B, et_off> result(a);
|
||||
using default_ops::eval_right_shift;
|
||||
detail::check_shift_range(b, mpl::bool_<(sizeof(I) > sizeof(std::size_t))>(), mpl::bool_<boost::multiprecision::detail::is_signed<I>::value>());
|
||||
detail::check_shift_range(b, std::integral_constant<bool, (sizeof(I) > sizeof(std::size_t))>(), std::integral_constant<bool, boost::multiprecision::detail::is_signed<I>::value>());
|
||||
eval_right_shift(result.backend(), b);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -156,27 +156,27 @@ template <class Backend, expression_template_option ExpressionTemplates = expres
|
||||
class number;
|
||||
|
||||
template <class T>
|
||||
struct is_number : public mpl::false_
|
||||
struct is_number : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <class Backend, expression_template_option ExpressionTemplates>
|
||||
struct is_number<number<Backend, ExpressionTemplates> > : public mpl::true_
|
||||
struct is_number<number<Backend, ExpressionTemplates> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
struct is_et_number : public mpl::false_
|
||||
struct is_et_number : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <class Backend>
|
||||
struct is_et_number<number<Backend, et_on> > : public mpl::true_
|
||||
struct is_et_number<number<Backend, et_on> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
struct is_no_et_number : public mpl::false_
|
||||
struct is_no_et_number : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <class Backend>
|
||||
struct is_no_et_number<number<Backend, et_off> > : public mpl::true_
|
||||
struct is_no_et_number<number<Backend, et_off> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
namespace detail {
|
||||
@@ -188,16 +188,16 @@ struct expression;
|
||||
} // namespace detail
|
||||
|
||||
template <class T>
|
||||
struct is_number_expression : public mpl::false_
|
||||
struct is_number_expression : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
|
||||
struct is_number_expression<detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > : public mpl::true_
|
||||
struct is_number_expression<detail::expression<tag, Arg1, Arg2, Arg3, Arg4> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template <class T, class Num>
|
||||
struct is_compatible_arithmetic_type
|
||||
: public mpl::bool_<
|
||||
: public std::integral_constant<bool,
|
||||
std::is_convertible<T, Num>::value && !std::is_same<T, Num>::value && !is_number_expression<T>::value>
|
||||
{};
|
||||
|
||||
@@ -257,10 +257,32 @@ template <int b>
|
||||
struct has_enough_bits
|
||||
{
|
||||
template <class T>
|
||||
struct type : public mpl::bool_<bits_of<T>::value >= b>
|
||||
struct type : public std::integral_constant<bool, bits_of<T>::value >= b>
|
||||
{};
|
||||
};
|
||||
|
||||
template <class Tuple, int i, int digits, bool = (i == std::tuple_size<Tuple>::value)>
|
||||
struct find_index_of_large_enough_type
|
||||
{
|
||||
static constexpr int value = bits_of<typename std::tuple_element<i, Tuple>::type>::value >= digits ? i : find_index_of_large_enough_type<Tuple, i + 1, digits>::value;
|
||||
};
|
||||
template <class Tuple, int i, int digits>
|
||||
struct find_index_of_large_enough_type<Tuple, i, digits, true>
|
||||
{
|
||||
static constexpr int value = INT_MAX;
|
||||
};
|
||||
|
||||
template <int index, class Tuple, class Fallback, bool = (std::tuple_size<Tuple>::value <= index)>
|
||||
struct dereference_tuple
|
||||
{
|
||||
typedef typename std::tuple_element<index, Tuple>::type type;
|
||||
};
|
||||
template <int index, class Tuple, class Fallback>
|
||||
struct dereference_tuple<index, Tuple, Fallback, true>
|
||||
{
|
||||
typedef Fallback type;
|
||||
};
|
||||
|
||||
template <class Val, class Backend, class Tag>
|
||||
struct canonical_imp
|
||||
{
|
||||
@@ -278,48 +300,36 @@ struct canonical_imp<number<B, et_off>, Backend, Tag>
|
||||
};
|
||||
#ifdef __SUNPRO_CC
|
||||
template <class B, class Backend>
|
||||
struct canonical_imp<number<B, et_on>, Backend, mpl::int_<3> >
|
||||
struct canonical_imp<number<B, et_on>, Backend, std::integral_constant<int, 3> >
|
||||
{
|
||||
typedef B type;
|
||||
};
|
||||
template <class B, class Backend>
|
||||
struct canonical_imp<number<B, et_off>, Backend, mpl::int_<3> >
|
||||
struct canonical_imp<number<B, et_off>, Backend, std::integral_constant<int, 3> >
|
||||
{
|
||||
typedef B type;
|
||||
};
|
||||
#endif
|
||||
template <class Val, class Backend>
|
||||
struct canonical_imp<Val, Backend, mpl::int_<0> >
|
||||
struct canonical_imp<Val, Backend, std::integral_constant<int, 0> >
|
||||
{
|
||||
typedef typename has_enough_bits<bits_of<Val>::value>::template type<mpl::_> pred_type;
|
||||
typedef typename mpl::find_if<
|
||||
typename Backend::signed_types,
|
||||
pred_type>::type iter_type;
|
||||
typedef typename mpl::end<typename Backend::signed_types>::type end_type;
|
||||
typedef typename mpl::eval_if_c<std::is_same<iter_type, end_type>::value, mpl::identity<Val>, mpl::deref<iter_type> >::type type;
|
||||
static constexpr int index = find_index_of_large_enough_type<typename Backend::signed_types, 0, bits_of<Val>::value>::value;
|
||||
typedef typename dereference_tuple<index, typename Backend::signed_types, Val>::type type;
|
||||
};
|
||||
template <class Val, class Backend>
|
||||
struct canonical_imp<Val, Backend, mpl::int_<1> >
|
||||
struct canonical_imp<Val, Backend, std::integral_constant<int, 1> >
|
||||
{
|
||||
typedef typename has_enough_bits<bits_of<Val>::value>::template type<mpl::_> pred_type;
|
||||
typedef typename mpl::find_if<
|
||||
typename Backend::unsigned_types,
|
||||
pred_type>::type iter_type;
|
||||
typedef typename mpl::end<typename Backend::unsigned_types>::type end_type;
|
||||
typedef typename mpl::eval_if_c<std::is_same<iter_type, end_type>::value, mpl::identity<Val>, mpl::deref<iter_type> >::type type;
|
||||
static constexpr int index = find_index_of_large_enough_type<typename Backend::unsigned_types, 0, bits_of<Val>::value>::value;
|
||||
typedef typename dereference_tuple<index, typename Backend::unsigned_types, Val>::type type;
|
||||
};
|
||||
template <class Val, class Backend>
|
||||
struct canonical_imp<Val, Backend, mpl::int_<2> >
|
||||
struct canonical_imp<Val, Backend, std::integral_constant<int, 2> >
|
||||
{
|
||||
typedef typename has_enough_bits<bits_of<Val>::value>::template type<mpl::_> pred_type;
|
||||
typedef typename mpl::find_if<
|
||||
typename Backend::float_types,
|
||||
pred_type>::type iter_type;
|
||||
typedef typename mpl::end<typename Backend::float_types>::type end_type;
|
||||
typedef typename mpl::eval_if_c<std::is_same<iter_type, end_type>::value, mpl::identity<Val>, mpl::deref<iter_type> >::type type;
|
||||
static constexpr int index = find_index_of_large_enough_type<typename Backend::float_types, 0, bits_of<Val>::value>::value;
|
||||
typedef typename dereference_tuple<index, typename Backend::float_types, Val>::type type;
|
||||
};
|
||||
template <class Val, class Backend>
|
||||
struct canonical_imp<Val, Backend, mpl::int_<3> >
|
||||
struct canonical_imp<Val, Backend, std::integral_constant<int, 3> >
|
||||
{
|
||||
typedef const char* type;
|
||||
};
|
||||
@@ -329,17 +339,17 @@ struct canonical
|
||||
{
|
||||
typedef typename std::conditional<
|
||||
boost::multiprecision::detail::is_signed<Val>::value && boost::multiprecision::detail::is_integral<Val>::value,
|
||||
mpl::int_<0>,
|
||||
std::integral_constant<int, 0>,
|
||||
typename std::conditional<
|
||||
boost::multiprecision::detail::is_unsigned<Val>::value,
|
||||
mpl::int_<1>,
|
||||
std::integral_constant<int, 1>,
|
||||
typename std::conditional<
|
||||
std::is_floating_point<Val>::value,
|
||||
mpl::int_<2>,
|
||||
std::integral_constant<int, 2>,
|
||||
typename std::conditional<
|
||||
(std::is_convertible<Val, const char*>::value || std::is_same<Val, std::string>::value),
|
||||
mpl::int_<3>,
|
||||
mpl::int_<4> >::type>::type>::type>::type tag_type;
|
||||
std::integral_constant<int, 3>,
|
||||
std::integral_constant<int, 4> >::type>::type>::type>::type tag_type;
|
||||
|
||||
typedef typename canonical_imp<Val, Backend, tag_type>::type type;
|
||||
};
|
||||
@@ -499,7 +509,7 @@ struct expression_storage<expression<tag, A1, A2, A3, A4> >
|
||||
template <class tag, class Arg1>
|
||||
struct expression<tag, Arg1, void, void, void>
|
||||
{
|
||||
typedef mpl::int_<1> arity;
|
||||
typedef std::integral_constant<int, 1> arity;
|
||||
typedef typename arg_type<Arg1>::type left_type;
|
||||
typedef typename left_type::result_type left_result_type;
|
||||
typedef typename left_type::result_type result_type;
|
||||
@@ -653,7 +663,7 @@ struct expression<tag, Arg1, void, void, void>
|
||||
template <class Arg1>
|
||||
struct expression<terminal, Arg1, void, void, void>
|
||||
{
|
||||
typedef mpl::int_<0> arity;
|
||||
typedef std::integral_constant<int, 0> arity;
|
||||
typedef Arg1 result_type;
|
||||
typedef terminal tag_type;
|
||||
|
||||
@@ -804,7 +814,7 @@ struct expression<terminal, Arg1, void, void, void>
|
||||
template <class tag, class Arg1, class Arg2>
|
||||
struct expression<tag, Arg1, Arg2, void, void>
|
||||
{
|
||||
typedef mpl::int_<2> arity;
|
||||
typedef std::integral_constant<int, 2> arity;
|
||||
typedef typename arg_type<Arg1>::type left_type;
|
||||
typedef typename arg_type<Arg2>::type right_type;
|
||||
typedef typename left_type::result_type left_result_type;
|
||||
@@ -964,7 +974,7 @@ struct expression<tag, Arg1, Arg2, void, void>
|
||||
template <class tag, class Arg1, class Arg2, class Arg3>
|
||||
struct expression<tag, Arg1, Arg2, Arg3, void>
|
||||
{
|
||||
typedef mpl::int_<3> arity;
|
||||
typedef std::integral_constant<int, 3> arity;
|
||||
typedef typename arg_type<Arg1>::type left_type;
|
||||
typedef typename arg_type<Arg2>::type middle_type;
|
||||
typedef typename arg_type<Arg3>::type right_type;
|
||||
@@ -1132,7 +1142,7 @@ struct expression<tag, Arg1, Arg2, Arg3, void>
|
||||
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
|
||||
struct expression
|
||||
{
|
||||
typedef mpl::int_<4> arity;
|
||||
typedef std::integral_constant<int, 4> arity;
|
||||
typedef typename arg_type<Arg1>::type left_type;
|
||||
typedef typename arg_type<Arg2>::type left_middle_type;
|
||||
typedef typename arg_type<Arg3>::type right_middle_type;
|
||||
@@ -1462,7 +1472,7 @@ void format_float_string(S& str, std::intmax_t my_exp, std::intmax_t digits, std
|
||||
}
|
||||
|
||||
template <class V>
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const mpl::true_&, const mpl::true_&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const std::integral_constant<bool, true>&, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
if (val > (std::numeric_limits<std::size_t>::max)())
|
||||
BOOST_THROW_EXCEPTION(std::out_of_range("Can not shift by a value greater than std::numeric_limits<std::size_t>::max()."));
|
||||
@@ -1470,19 +1480,19 @@ BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const mpl::true_&, const
|
||||
BOOST_THROW_EXCEPTION(std::out_of_range("Can not shift by a negative value."));
|
||||
}
|
||||
template <class V>
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const mpl::false_&, const mpl::true_&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const std::integral_constant<bool, false>&, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
if (val < 0)
|
||||
BOOST_THROW_EXCEPTION(std::out_of_range("Can not shift by a negative value."));
|
||||
}
|
||||
template <class V>
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const mpl::true_&, const mpl::false_&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const std::integral_constant<bool, true>&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
if (val > (std::numeric_limits<std::size_t>::max)())
|
||||
BOOST_THROW_EXCEPTION(std::out_of_range("Can not shift by a value greater than std::numeric_limits<std::size_t>::max()."));
|
||||
}
|
||||
template <class V>
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V, const mpl::false_&, const mpl::false_&) BOOST_NOEXCEPT {}
|
||||
BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V, const std::integral_constant<bool, false>&, const std::integral_constant<bool, false>&) BOOST_NOEXCEPT {}
|
||||
|
||||
template <class T>
|
||||
BOOST_MP_CXX14_CONSTEXPR const T& evaluate_if_expression(const T& val) { return val; }
|
||||
@@ -1505,10 +1515,10 @@ enum number_category_type
|
||||
};
|
||||
|
||||
template <class Num, bool, bool>
|
||||
struct number_category_base : public mpl::int_<number_kind_unknown>
|
||||
struct number_category_base : public std::integral_constant<int, number_kind_unknown>
|
||||
{};
|
||||
template <class Num>
|
||||
struct number_category_base<Num, true, false> : public mpl::int_<std::numeric_limits<Num>::is_integer ? number_kind_integer : (std::numeric_limits<Num>::max_exponent ? number_kind_floating_point : number_kind_unknown)>
|
||||
struct number_category_base<Num, true, false> : public std::integral_constant<int, std::numeric_limits<Num>::is_integer ? number_kind_integer : (std::numeric_limits<Num>::max_exponent ? number_kind_floating_point : number_kind_unknown)>
|
||||
{};
|
||||
template <class Num>
|
||||
struct number_category : public number_category_base<Num, std::is_class<Num>::value || boost::multiprecision::detail::is_arithmetic<Num>::value, std::is_abstract<Num>::value>
|
||||
@@ -1524,15 +1534,15 @@ struct number_category<detail::expression<tag, A1, A2, A3, A4> > : public number
|
||||
//
|
||||
#ifdef BOOST_HAS_INT128
|
||||
template <>
|
||||
struct number_category<boost::int128_type> : public mpl::int_<number_kind_integer>
|
||||
struct number_category<boost::int128_type> : public std::integral_constant<int, number_kind_integer>
|
||||
{};
|
||||
template <>
|
||||
struct number_category<boost::uint128_type> : public mpl::int_<number_kind_integer>
|
||||
struct number_category<boost::uint128_type> : public std::integral_constant<int, number_kind_integer>
|
||||
{};
|
||||
#endif
|
||||
#ifdef BOOST_HAS_FLOAT128
|
||||
template <>
|
||||
struct number_category<__float128> : public mpl::int_<number_kind_floating_point>
|
||||
struct number_category<__float128> : public std::integral_constant<int, number_kind_floating_point>
|
||||
{};
|
||||
#endif
|
||||
|
||||
@@ -1556,16 +1566,16 @@ template <class T>
|
||||
struct complex_result_from_scalar; // individual backends must specialize this trait.
|
||||
|
||||
template <class T>
|
||||
struct is_unsigned_number : public mpl::false_
|
||||
struct is_unsigned_number : public std::integral_constant<bool, false>
|
||||
{};
|
||||
template <class Backend, expression_template_option ExpressionTemplates>
|
||||
struct is_unsigned_number<number<Backend, ExpressionTemplates> > : public is_unsigned_number<Backend>
|
||||
{};
|
||||
template <class T>
|
||||
struct is_signed_number : public mpl::bool_<!is_unsigned_number<T>::value>
|
||||
struct is_signed_number : public std::integral_constant<bool, !is_unsigned_number<T>::value>
|
||||
{};
|
||||
template <class T>
|
||||
struct is_interval_number : public mpl::false_
|
||||
struct is_interval_number : public std::integral_constant<bool, false>
|
||||
{};
|
||||
template <class Backend, expression_template_option ExpressionTemplates>
|
||||
struct is_interval_number<number<Backend, ExpressionTemplates> > : public is_interval_number<Backend>
|
||||
@@ -1614,7 +1624,7 @@ namespace boost { namespace math {
|
||||
}
|
||||
|
||||
template <class B, boost::multiprecision::expression_template_option ET>
|
||||
struct is_complex_type<boost::multiprecision::number<B, ET> > : public boost::mpl::bool_<boost::multiprecision::number_category<B>::value == boost::multiprecision::number_kind_complex> {};
|
||||
struct is_complex_type<boost::multiprecision::number<B, ET> > : public std::integral_constant<bool, boost::multiprecision::number_category<B>::value == boost::multiprecision::number_kind_complex> {};
|
||||
|
||||
} // namespace tools
|
||||
|
||||
|
||||
@@ -27,13 +27,13 @@ inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq(const B& a, const B& b)
|
||||
return a.compare(b) == 0;
|
||||
}
|
||||
template <class T, class U>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq_imp(const T& a, const U& b, const mpl::true_&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq_imp(const T& a, const U& b, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
typename boost::multiprecision::detail::number_from_backend<T, U>::type t(b);
|
||||
return eval_eq(a, t.backend());
|
||||
}
|
||||
template <class T, class U>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq_imp(const T& a, const U& b, const mpl::false_&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq_imp(const T& a, const U& b, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
typename boost::multiprecision::detail::number_from_backend<U, T>::type t(a);
|
||||
return eval_eq(t.backend(), b);
|
||||
@@ -41,7 +41,7 @@ inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq_imp(const T& a, const U& b, const m
|
||||
template <class T, class U>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq(const T& a, const U& b)
|
||||
{
|
||||
typedef mpl::bool_<boost::multiprecision::detail::is_first_backend<T, U>::value> tag_type;
|
||||
typedef std::integral_constant<bool, boost::multiprecision::detail::is_first_backend<T, U>::value> tag_type;
|
||||
return eval_eq_imp(a, b, tag_type());
|
||||
}
|
||||
|
||||
@@ -51,13 +51,13 @@ inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt(const B& a, const B& b)
|
||||
return a.compare(b) < 0;
|
||||
}
|
||||
template <class T, class U>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt_imp(const T& a, const U& b, const mpl::true_&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt_imp(const T& a, const U& b, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
typename boost::multiprecision::detail::number_from_backend<T, U>::type t(b);
|
||||
return eval_lt(a, t.backend());
|
||||
}
|
||||
template <class T, class U>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt_imp(const T& a, const U& b, const mpl::false_&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt_imp(const T& a, const U& b, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
typename boost::multiprecision::detail::number_from_backend<U, T>::type t(a);
|
||||
return eval_lt(t.backend(), b);
|
||||
@@ -65,7 +65,7 @@ inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt_imp(const T& a, const U& b, const m
|
||||
template <class T, class U>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt(const T& a, const U& b)
|
||||
{
|
||||
typedef mpl::bool_<boost::multiprecision::detail::is_first_backend<T, U>::value> tag_type;
|
||||
typedef std::integral_constant<bool, boost::multiprecision::detail::is_first_backend<T, U>::value> tag_type;
|
||||
return eval_lt_imp(a, b, tag_type());
|
||||
}
|
||||
|
||||
@@ -75,13 +75,13 @@ inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt(const B& a, const B& b)
|
||||
return a.compare(b) > 0;
|
||||
}
|
||||
template <class T, class U>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt_imp(const T& a, const U& b, const mpl::true_&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt_imp(const T& a, const U& b, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
typename boost::multiprecision::detail::number_from_backend<T, U>::type t(b);
|
||||
return eval_gt(a, t.backend());
|
||||
}
|
||||
template <class T, class U>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt_imp(const T& a, const U& b, const mpl::false_&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt_imp(const T& a, const U& b, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
typename boost::multiprecision::detail::number_from_backend<U, T>::type t(a);
|
||||
return eval_gt(t.backend(), b);
|
||||
@@ -89,7 +89,7 @@ inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt_imp(const T& a, const U& b, const m
|
||||
template <class T, class U>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt(const T& a, const U& b)
|
||||
{
|
||||
typedef mpl::bool_<boost::multiprecision::detail::is_first_backend<T, U>::value> tag_type;
|
||||
typedef std::integral_constant<bool, boost::multiprecision::detail::is_first_backend<T, U>::value> tag_type;
|
||||
return eval_gt_imp(a, b, tag_type());
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt(const T& a, const U& b)
|
||||
namespace detail {
|
||||
|
||||
template <class Num, class Val>
|
||||
struct is_valid_mixed_compare : public mpl::false_
|
||||
struct is_valid_mixed_compare : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <class B, expression_template_option ET, class Val>
|
||||
@@ -106,7 +106,7 @@ struct is_valid_mixed_compare<number<B, ET>, Val> : public std::is_convertible<V
|
||||
{};
|
||||
|
||||
template <class B, expression_template_option ET>
|
||||
struct is_valid_mixed_compare<number<B, ET>, number<B, ET> > : public mpl::false_
|
||||
struct is_valid_mixed_compare<number<B, ET>, number<B, ET> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <class B, expression_template_option ET, class tag, class Arg1, class Arg2, class Arg3, class Arg4>
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
namespace boost { namespace multiprecision { namespace detail {
|
||||
|
||||
template <class B, boost::multiprecision::expression_template_option ET>
|
||||
inline constexpr unsigned current_precision_of_last_chance_imp(const boost::multiprecision::number<B, ET>&, const mpl::false_&)
|
||||
inline constexpr unsigned current_precision_of_last_chance_imp(const boost::multiprecision::number<B, ET>&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
return std::numeric_limits<boost::multiprecision::number<B, ET> >::digits10;
|
||||
}
|
||||
template <class B, boost::multiprecision::expression_template_option ET>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR unsigned current_precision_of_last_chance_imp(const boost::multiprecision::number<B, ET>& val, const mpl::true_&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR unsigned current_precision_of_last_chance_imp(const boost::multiprecision::number<B, ET>& val, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
//
|
||||
// We have an arbitrary precision integer, take it's "precision" as the
|
||||
@@ -38,7 +38,7 @@ template <class B, boost::multiprecision::expression_template_option ET>
|
||||
inline constexpr unsigned current_precision_of_imp(const boost::multiprecision::number<B, ET>& val, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
return current_precision_of_last_chance_imp(val,
|
||||
mpl::bool_ <
|
||||
std::integral_constant<bool,
|
||||
std::numeric_limits<boost::multiprecision::number<B, ET> >::is_specialized &&
|
||||
std::numeric_limits<boost::multiprecision::number<B, ET> >::is_integer && std::numeric_limits<boost::multiprecision::number<B, ET> >::is_exact && !std::numeric_limits<boost::multiprecision::number<B, ET> >::is_modulo > ());
|
||||
}
|
||||
@@ -158,10 +158,10 @@ struct scoped_default_precision<R, true>
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void maybe_promote_precision(T*, const mpl::false_&) {}
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void maybe_promote_precision(T*, const std::integral_constant<bool, false>&) {}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void maybe_promote_precision(T* obj, const mpl::true_&)
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void maybe_promote_precision(T* obj, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
if (obj->precision() != T::default_precision())
|
||||
{
|
||||
@@ -172,7 +172,7 @@ inline BOOST_MP_CXX14_CONSTEXPR void maybe_promote_precision(T* obj, const mpl::
|
||||
template <class T>
|
||||
inline BOOST_MP_CXX14_CONSTEXPR void maybe_promote_precision(T* obj)
|
||||
{
|
||||
maybe_promote_precision(obj, mpl::bool_<boost::multiprecision::detail::is_variable_precision<T>::value>());
|
||||
maybe_promote_precision(obj, std::integral_constant<bool, boost::multiprecision::detail::is_variable_precision<T>::value>());
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CXX17_IF_CONSTEXPR
|
||||
|
||||
@@ -47,18 +47,18 @@ struct NumTraits<boost::multiprecision::number<Backend, ExpressionTemplates> >
|
||||
{
|
||||
return (std::numeric_limits<Real>::min)();
|
||||
}
|
||||
static int digits10_imp(const boost::mpl::true_&)
|
||||
static int digits10_imp(const std::integral_constant<bool, true>&)
|
||||
{
|
||||
return std::numeric_limits<Real>::digits10;
|
||||
}
|
||||
template <bool B>
|
||||
static int digits10_imp(const boost::mpl::bool_<B>&)
|
||||
static int digits10_imp(const std::integral_constant<bool, B>&)
|
||||
{
|
||||
return Real::default_precision();
|
||||
}
|
||||
static int digits10()
|
||||
{
|
||||
return digits10_imp(boost::mpl::bool_ < std::numeric_limits<Real>::digits10 && (std::numeric_limits<Real>::digits10 != INT_MAX) ? true : false > ());
|
||||
return digits10_imp(std::integral_constant<bool, std::numeric_limits<Real>::digits10 && (std::numeric_limits<Real>::digits10 != INT_MAX) ? true : false > ());
|
||||
}
|
||||
};
|
||||
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#define BOOST_MP_FLOAT128_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/multiprecision/number.hpp>
|
||||
|
||||
@@ -133,11 +132,11 @@ struct float128_backend;
|
||||
using backends::float128_backend;
|
||||
|
||||
template <>
|
||||
struct number_category<backends::float128_backend> : public mpl::int_<number_kind_floating_point>
|
||||
struct number_category<backends::float128_backend> : public std::integral_constant<int, number_kind_floating_point>
|
||||
{};
|
||||
#if defined(BOOST_MP_USE_QUAD)
|
||||
template <>
|
||||
struct number_category<float128_type> : public mpl::int_<number_kind_floating_point>
|
||||
struct number_category<float128_type> : public std::integral_constant<int, number_kind_floating_point>
|
||||
{};
|
||||
#endif
|
||||
|
||||
@@ -162,11 +161,11 @@ namespace backends {
|
||||
|
||||
struct float128_backend
|
||||
{
|
||||
typedef mpl::list<signed char, short, int, long, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<unsigned char, unsigned short,
|
||||
typedef std::tuple<signed char, short, int, long, boost::long_long_type> signed_types;
|
||||
typedef std::tuple<unsigned char, unsigned short,
|
||||
unsigned int, unsigned long, boost::ulong_long_type>
|
||||
unsigned_types;
|
||||
typedef mpl::list<float, double, long double> float_types;
|
||||
typedef std::tuple<float, double, long double> float_types;
|
||||
typedef int exponent_type;
|
||||
|
||||
private:
|
||||
@@ -259,7 +258,7 @@ struct float128_backend
|
||||
if ((v < 0) || (v >= 127))
|
||||
{
|
||||
int v_max = v;
|
||||
boost::scoped_array<char> buf2;
|
||||
std::unique_ptr<char[]> buf2;
|
||||
buf2.reset(new char[v + 3]);
|
||||
v = quadmath_snprintf(&buf2[0], v_max + 3, format.c_str(), digits, m_value);
|
||||
if (v >= v_max + 3)
|
||||
@@ -741,7 +740,7 @@ namespace serialization {
|
||||
namespace float128_detail {
|
||||
|
||||
template <class Archive>
|
||||
void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const mpl::false_&, const mpl::false_&)
|
||||
void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const std::integral_constant<bool, false>&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
// saving
|
||||
// non-binary
|
||||
@@ -749,7 +748,7 @@ void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend
|
||||
ar& boost::make_nvp("value", s);
|
||||
}
|
||||
template <class Archive>
|
||||
void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const mpl::true_&, const mpl::false_&)
|
||||
void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const std::integral_constant<bool, true>&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
// loading
|
||||
// non-binary
|
||||
@@ -759,14 +758,14 @@ void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const mpl::false_&, const mpl::true_&)
|
||||
void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const std::integral_constant<bool, false>&, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
// saving
|
||||
// binary
|
||||
ar.save_binary(&val, sizeof(val));
|
||||
}
|
||||
template <class Archive>
|
||||
void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const mpl::true_&, const mpl::true_&)
|
||||
void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const std::integral_constant<bool, true>&, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
// loading
|
||||
// binary
|
||||
@@ -779,7 +778,7 @@ template <class Archive>
|
||||
void serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, unsigned int /*version*/)
|
||||
{
|
||||
typedef typename Archive::is_loading load_tag;
|
||||
typedef typename mpl::bool_<std::is_same<Archive, boost::archive::binary_oarchive>::value || std::is_same<Archive, boost::archive::binary_iarchive>::value> binary_tag;
|
||||
typedef typename std::integral_constant<bool, std::is_same<Archive, boost::archive::binary_oarchive>::value || std::is_same<Archive, boost::archive::binary_iarchive>::value> binary_tag;
|
||||
|
||||
float128_detail::do_serialize(ar, val, load_tag(), binary_tag());
|
||||
}
|
||||
|
||||
@@ -63,13 +63,13 @@ struct gmp_rational;
|
||||
} // namespace backends
|
||||
|
||||
template <>
|
||||
struct number_category<backends::gmp_int> : public mpl::int_<number_kind_integer>
|
||||
struct number_category<backends::gmp_int> : public std::integral_constant<int, number_kind_integer>
|
||||
{};
|
||||
template <>
|
||||
struct number_category<backends::gmp_rational> : public mpl::int_<number_kind_rational>
|
||||
struct number_category<backends::gmp_rational> : public std::integral_constant<int, number_kind_rational>
|
||||
{};
|
||||
template <unsigned digits10>
|
||||
struct number_category<backends::gmp_float<digits10> > : public mpl::int_<number_kind_floating_point>
|
||||
struct number_category<backends::gmp_float<digits10> > : public std::integral_constant<int, number_kind_floating_point>
|
||||
{};
|
||||
|
||||
namespace backends {
|
||||
@@ -84,13 +84,13 @@ template <unsigned digits10>
|
||||
struct gmp_float_imp
|
||||
{
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
typedef mpl::list<long, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
typedef std::tuple<long, boost::long_long_type> signed_types;
|
||||
typedef std::tuple<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
#else
|
||||
typedef mpl::list<long> signed_types;
|
||||
typedef mpl::list<unsigned long> unsigned_types;
|
||||
typedef std::tuple<long> signed_types;
|
||||
typedef std::tuple<unsigned long> unsigned_types;
|
||||
#endif
|
||||
typedef mpl::list<double, long double> float_types;
|
||||
typedef std::tuple<double, long double> float_types;
|
||||
typedef long exponent_type;
|
||||
|
||||
gmp_float_imp() BOOST_NOEXCEPT
|
||||
@@ -1111,13 +1111,13 @@ inline std::size_t hash_value(const gmp_float<Digits10>& val)
|
||||
struct gmp_int
|
||||
{
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
typedef mpl::list<long, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
typedef std::tuple<long, boost::long_long_type> signed_types;
|
||||
typedef std::tuple<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
#else
|
||||
typedef mpl::list<long> signed_types;
|
||||
typedef mpl::list<unsigned long> unsigned_types;
|
||||
typedef std::tuple<long> signed_types;
|
||||
typedef std::tuple<unsigned long> unsigned_types;
|
||||
#endif
|
||||
typedef mpl::list<double, long double> float_types;
|
||||
typedef std::tuple<double, long double> float_types;
|
||||
|
||||
gmp_int()
|
||||
{
|
||||
@@ -2017,13 +2017,13 @@ void eval_add(gmp_rational& t, const gmp_rational& o);
|
||||
struct gmp_rational
|
||||
{
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
typedef mpl::list<long, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
typedef std::tuple<long, boost::long_long_type> signed_types;
|
||||
typedef std::tuple<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
#else
|
||||
typedef mpl::list<long> signed_types;
|
||||
typedef mpl::list<unsigned long> unsigned_types;
|
||||
typedef std::tuple<long> signed_types;
|
||||
typedef std::tuple<unsigned long> unsigned_types;
|
||||
#endif
|
||||
typedef mpl::list<double, long double> float_types;
|
||||
typedef std::tuple<double, long double> float_types;
|
||||
|
||||
gmp_rational()
|
||||
{
|
||||
@@ -2586,13 +2586,13 @@ struct transcendental_reduction_type<boost::multiprecision::backends::gmp_float<
|
||||
} // namespace detail
|
||||
|
||||
template <>
|
||||
struct number_category<detail::canonical<mpz_t, gmp_int>::type> : public mpl::int_<number_kind_integer>
|
||||
struct number_category<detail::canonical<mpz_t, gmp_int>::type> : public std::integral_constant<int, number_kind_integer>
|
||||
{};
|
||||
template <>
|
||||
struct number_category<detail::canonical<mpq_t, gmp_rational>::type> : public mpl::int_<number_kind_rational>
|
||||
struct number_category<detail::canonical<mpq_t, gmp_rational>::type> : public std::integral_constant<int, number_kind_rational>
|
||||
{};
|
||||
template <>
|
||||
struct number_category<detail::canonical<mpf_t, gmp_float<0> >::type> : public mpl::int_<number_kind_floating_point>
|
||||
struct number_category<detail::canonical<mpf_t, gmp_float<0> >::type> : public std::integral_constant<int, number_kind_floating_point>
|
||||
{};
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -33,7 +33,7 @@ struct mpc_complex_backend;
|
||||
} // namespace backends
|
||||
|
||||
template <unsigned digits10>
|
||||
struct number_category<backends::mpc_complex_backend<digits10> > : public mpl::int_<number_kind_complex>
|
||||
struct number_category<backends::mpc_complex_backend<digits10> > : public std::integral_constant<int, number_kind_complex>
|
||||
{};
|
||||
|
||||
namespace backends {
|
||||
@@ -62,13 +62,13 @@ template <unsigned digits10>
|
||||
struct mpc_complex_imp
|
||||
{
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
typedef mpl::list<long, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
typedef std::tuple<long, boost::long_long_type> signed_types;
|
||||
typedef std::tuple<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
#else
|
||||
typedef mpl::list<long> signed_types;
|
||||
typedef mpl::list<unsigned long> unsigned_types;
|
||||
typedef std::tuple<long> signed_types;
|
||||
typedef std::tuple<unsigned long> unsigned_types;
|
||||
#endif
|
||||
typedef mpl::list<double, long double> float_types;
|
||||
typedef std::tuple<double, long double> float_types;
|
||||
typedef long exponent_type;
|
||||
|
||||
mpc_complex_imp()
|
||||
@@ -1475,7 +1475,7 @@ struct is_variable_precision<backends::mpc_complex_backend<0> > : public std::in
|
||||
} // namespace detail
|
||||
|
||||
template <>
|
||||
struct number_category<detail::canonical<mpc_t, backends::mpc_complex_backend<0> >::type> : public mpl::int_<number_kind_floating_point>
|
||||
struct number_category<detail::canonical<mpc_t, backends::mpc_complex_backend<0> >::type> : public std::integral_constant<int, number_kind_floating_point>
|
||||
{};
|
||||
|
||||
using boost::multiprecision::backends::mpc_complex_backend;
|
||||
|
||||
@@ -35,7 +35,7 @@ struct mpfi_float_backend;
|
||||
} // namespace backends
|
||||
|
||||
template <unsigned digits10>
|
||||
struct number_category<backends::mpfi_float_backend<digits10> > : public mpl::int_<number_kind_floating_point>
|
||||
struct number_category<backends::mpfi_float_backend<digits10> > : public std::integral_constant<int, number_kind_floating_point>
|
||||
{};
|
||||
|
||||
struct interval_error : public std::runtime_error
|
||||
@@ -65,13 +65,13 @@ template <unsigned digits10>
|
||||
struct mpfi_float_imp
|
||||
{
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
typedef mpl::list<long, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
typedef std::tuple<long, boost::long_long_type> signed_types;
|
||||
typedef std::tuple<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
#else
|
||||
typedef mpl::list<long> signed_types;
|
||||
typedef mpl::list<unsigned long> unsigned_types;
|
||||
typedef std::tuple<long> signed_types;
|
||||
typedef std::tuple<unsigned long> unsigned_types;
|
||||
#endif
|
||||
typedef mpl::list<double, long double> float_types;
|
||||
typedef std::tuple<double, long double> float_types;
|
||||
typedef long exponent_type;
|
||||
|
||||
mpfi_float_imp()
|
||||
@@ -1082,7 +1082,7 @@ inline std::size_t hash_value(const mpfi_float_backend<Digits10>& val)
|
||||
}
|
||||
|
||||
template <class To, unsigned D>
|
||||
void generic_interconvert(To& to, const mpfi_float_backend<D>& from, const mpl::int_<number_kind_integer>& to_type, const mpl::int_<number_kind_floating_point>& from_type)
|
||||
void generic_interconvert(To& to, const mpfi_float_backend<D>& from, const std::integral_constant<int, number_kind_integer>& to_type, const std::integral_constant<int, number_kind_floating_point>& from_type)
|
||||
{
|
||||
using boost::multiprecision::detail::generic_interconvert;
|
||||
mpfr_float_backend<D> t;
|
||||
@@ -1091,7 +1091,7 @@ void generic_interconvert(To& to, const mpfi_float_backend<D>& from, const mpl::
|
||||
}
|
||||
|
||||
template <class To, unsigned D>
|
||||
void generic_interconvert(To& to, const mpfi_float_backend<D>& from, const mpl::int_<number_kind_rational>& to_type, const mpl::int_<number_kind_floating_point>& from_type)
|
||||
void generic_interconvert(To& to, const mpfi_float_backend<D>& from, const std::integral_constant<int, number_kind_rational>& to_type, const std::integral_constant<int, number_kind_floating_point>& from_type)
|
||||
{
|
||||
using boost::multiprecision::detail::generic_interconvert;
|
||||
mpfr_float_backend<D> t;
|
||||
@@ -1100,7 +1100,7 @@ void generic_interconvert(To& to, const mpfi_float_backend<D>& from, const mpl::
|
||||
}
|
||||
|
||||
template <class To, unsigned D>
|
||||
void generic_interconvert(To& to, const mpfi_float_backend<D>& from, const mpl::int_<number_kind_floating_point>& to_type, const mpl::int_<number_kind_floating_point>& from_type)
|
||||
void generic_interconvert(To& to, const mpfi_float_backend<D>& from, const std::integral_constant<int, number_kind_floating_point>& to_type, const std::integral_constant<int, number_kind_floating_point>& from_type)
|
||||
{
|
||||
using boost::multiprecision::detail::generic_interconvert;
|
||||
mpfr_float_backend<D> t;
|
||||
@@ -1117,10 +1117,10 @@ struct is_variable_precision<backends::mpfi_float_backend<0> > : public std::int
|
||||
} // namespace detail
|
||||
|
||||
template <>
|
||||
struct number_category<detail::canonical<mpfi_t, backends::mpfi_float_backend<0> >::type> : public mpl::int_<number_kind_floating_point>
|
||||
struct number_category<detail::canonical<mpfi_t, backends::mpfi_float_backend<0> >::type> : public std::integral_constant<int, number_kind_floating_point>
|
||||
{};
|
||||
template <unsigned Digits10>
|
||||
struct is_interval_number<backends::mpfi_float_backend<Digits10> > : public mpl::true_
|
||||
struct is_interval_number<backends::mpfi_float_backend<Digits10> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
using boost::multiprecision::backends::mpfi_float_backend;
|
||||
|
||||
@@ -43,7 +43,7 @@ struct mpfr_float_backend<0, allocate_stack>;
|
||||
} // namespace backends
|
||||
|
||||
template <unsigned digits10, mpfr_allocation_type AllocationType>
|
||||
struct number_category<backends::mpfr_float_backend<digits10, AllocationType> > : public mpl::int_<number_kind_floating_point>
|
||||
struct number_category<backends::mpfr_float_backend<digits10, AllocationType> > : public std::integral_constant<int, number_kind_floating_point>
|
||||
{};
|
||||
|
||||
namespace backends {
|
||||
@@ -91,13 +91,13 @@ template <unsigned digits10>
|
||||
struct mpfr_float_imp<digits10, allocate_dynamic>
|
||||
{
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
typedef mpl::list<long, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
typedef std::tuple<long, boost::long_long_type> signed_types;
|
||||
typedef std::tuple<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
#else
|
||||
typedef mpl::list<long> signed_types;
|
||||
typedef mpl::list<unsigned long> unsigned_types;
|
||||
typedef std::tuple<long> signed_types;
|
||||
typedef std::tuple<unsigned long> unsigned_types;
|
||||
#endif
|
||||
typedef mpl::list<double, long double> float_types;
|
||||
typedef std::tuple<double, long double> float_types;
|
||||
typedef long exponent_type;
|
||||
|
||||
mpfr_float_imp()
|
||||
@@ -413,13 +413,13 @@ template <unsigned digits10>
|
||||
struct mpfr_float_imp<digits10, allocate_stack>
|
||||
{
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
typedef mpl::list<long, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
typedef std::tuple<long, boost::long_long_type> signed_types;
|
||||
typedef std::tuple<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
#else
|
||||
typedef mpl::list<long> signed_types;
|
||||
typedef mpl::list<unsigned long> unsigned_types;
|
||||
typedef std::tuple<long> signed_types;
|
||||
typedef std::tuple<unsigned long> unsigned_types;
|
||||
#endif
|
||||
typedef mpl::list<double, long double> float_types;
|
||||
typedef std::tuple<double, long double> float_types;
|
||||
typedef long exponent_type;
|
||||
|
||||
static const unsigned digits2 = (digits10 * 1000uL) / 301uL + ((digits10 * 1000uL) % 301 ? 2u : 1u);
|
||||
@@ -1611,11 +1611,11 @@ struct is_variable_precision<backends::mpfr_float_backend<0> > : public std::int
|
||||
} // namespace detail
|
||||
|
||||
template <>
|
||||
struct number_category<detail::canonical<mpfr_t, backends::mpfr_float_backend<0> >::type> : public mpl::int_<number_kind_floating_point>
|
||||
struct number_category<detail::canonical<mpfr_t, backends::mpfr_float_backend<0> >::type> : public std::integral_constant<int, number_kind_floating_point>
|
||||
{};
|
||||
|
||||
template <unsigned D, boost::multiprecision::mpfr_allocation_type A1, boost::multiprecision::mpfr_allocation_type A2>
|
||||
struct is_equivalent_number_type<backends::mpfr_float_backend<D, A1>, backends::mpfr_float_backend<D, A2> > : public mpl::true_ {};
|
||||
struct is_equivalent_number_type<backends::mpfr_float_backend<D, A1>, backends::mpfr_float_backend<D, A2> > : public std::integral_constant<bool, true> {};
|
||||
|
||||
using boost::multiprecision::backends::mpfr_float_backend;
|
||||
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <cstdint>
|
||||
#include <boost/mpl/max.hpp>
|
||||
#include <boost/mpl/plus.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/find_if.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/multiprecision/detail/precision.hpp>
|
||||
@@ -186,7 +182,7 @@ class number
|
||||
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
|
||||
BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<std::is_convertible<typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type, self_type>::value, number&>::type operator=(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
|
||||
{
|
||||
typedef mpl::bool_<is_equivalent_number_type<number, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>::value> tag_type;
|
||||
typedef std::integral_constant<bool, is_equivalent_number_type<number, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>::value> tag_type;
|
||||
detail::scoped_default_precision<number<Backend, ExpressionTemplates> > precision_guard(e);
|
||||
//
|
||||
// If the current precision of *this differs from that of expression e, then we
|
||||
@@ -209,7 +205,7 @@ class number
|
||||
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
|
||||
BOOST_MP_CXX14_CONSTEXPR number& assign(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
|
||||
{
|
||||
typedef mpl::bool_<is_equivalent_number_type<number, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>::value> tag_type;
|
||||
typedef std::integral_constant<bool, is_equivalent_number_type<number, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>::value> tag_type;
|
||||
detail::scoped_default_precision<number<Backend, ExpressionTemplates> > precision_guard(e);
|
||||
//
|
||||
// If the current precision of *this differs from that of expression e, then we
|
||||
@@ -622,7 +618,7 @@ class number
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<boost::multiprecision::detail::is_integral<V>::value, number&>::type operator<<=(V val)
|
||||
{
|
||||
static_assert(number_category<Backend>::value == number_kind_integer, "The left-shift operation is only valid for integer types");
|
||||
detail::check_shift_range(val, mpl::bool_<(sizeof(V) > sizeof(std::size_t))>(), mpl::bool_<boost::multiprecision::detail::is_signed<V>::value && boost::multiprecision::detail::is_integral<V>::value > ());
|
||||
detail::check_shift_range(val, std::integral_constant<bool, (sizeof(V) > sizeof(std::size_t))>(), std::integral_constant<bool, boost::multiprecision::detail::is_signed<V>::value && boost::multiprecision::detail::is_integral<V>::value > ());
|
||||
eval_left_shift(m_backend, static_cast<std::size_t>(canonical_value(val)));
|
||||
return *this;
|
||||
}
|
||||
@@ -631,7 +627,7 @@ class number
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<boost::multiprecision::detail::is_integral<V>::value, number&>::type operator>>=(V val)
|
||||
{
|
||||
static_assert(number_category<Backend>::value == number_kind_integer, "The right-shift operation is only valid for integer types");
|
||||
detail::check_shift_range(val, mpl::bool_<(sizeof(V) > sizeof(std::size_t))>(), mpl::bool_<boost::multiprecision::detail::is_signed<V>::value && boost::multiprecision::detail::is_integral<V>::value>());
|
||||
detail::check_shift_range(val, std::integral_constant<bool, (sizeof(V) > sizeof(std::size_t))>(), std::integral_constant<bool, boost::multiprecision::detail::is_signed<V>::value && boost::multiprecision::detail::is_integral<V>::value>());
|
||||
eval_right_shift(m_backend, static_cast<std::size_t>(canonical_value(val)));
|
||||
return *this;
|
||||
}
|
||||
@@ -949,13 +945,13 @@ class number
|
||||
|
||||
private:
|
||||
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e, const mpl::true_&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
do_assign(e, tag());
|
||||
}
|
||||
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
|
||||
BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<std::is_assignable<number, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>::value>::type
|
||||
do_assign(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e, const mpl::false_&)
|
||||
do_assign(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
// The result of the expression isn't the same type as this -
|
||||
// create a temporary result and assign it to *this:
|
||||
@@ -965,7 +961,7 @@ class number
|
||||
}
|
||||
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
|
||||
BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<!std::is_assignable<number, typename detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type>::value>::type
|
||||
do_assign(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e, const mpl::false_&)
|
||||
do_assign(const detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
// The result of the expression isn't the same type as this -
|
||||
// create a temporary result and assign it to *this:
|
||||
@@ -1404,7 +1400,7 @@ class number
|
||||
{
|
||||
static_assert(number_category<Backend>::value == number_kind_integer, "The right shift operation is only valid for integer types");
|
||||
using default_ops::eval_right_shift;
|
||||
detail::check_shift_range(val, mpl::bool_<(sizeof(Val) > sizeof(std::size_t))>(), mpl::bool_<boost::multiprecision::detail::is_signed<Val>::value && boost::multiprecision::detail::is_integral<Val>::value>());
|
||||
detail::check_shift_range(val, std::integral_constant<bool, (sizeof(Val) > sizeof(std::size_t))>(), std::integral_constant<bool, boost::multiprecision::detail::is_signed<Val>::value && boost::multiprecision::detail::is_integral<Val>::value>());
|
||||
eval_right_shift(m_backend, canonical_value(e.value()), static_cast<std::size_t>(val));
|
||||
}
|
||||
|
||||
@@ -1413,7 +1409,7 @@ class number
|
||||
{
|
||||
static_assert(number_category<Backend>::value == number_kind_integer, "The left shift operation is only valid for integer types");
|
||||
using default_ops::eval_left_shift;
|
||||
detail::check_shift_range(val, mpl::bool_<(sizeof(Val) > sizeof(std::size_t))>(), mpl::bool_<boost::multiprecision::detail::is_signed<Val>::value && boost::multiprecision::detail::is_integral<Val>::value>());
|
||||
detail::check_shift_range(val, std::integral_constant<bool, (sizeof(Val) > sizeof(std::size_t))>(), std::integral_constant<bool, boost::multiprecision::detail::is_signed<Val>::value && boost::multiprecision::detail::is_integral<Val>::value>());
|
||||
eval_left_shift(m_backend, canonical_value(e.value()), static_cast<std::size_t>(val));
|
||||
}
|
||||
|
||||
@@ -1423,7 +1419,7 @@ class number
|
||||
static_assert(number_category<Backend>::value == number_kind_integer, "The right shift operation is only valid for integer types");
|
||||
using default_ops::eval_right_shift;
|
||||
self_type temp(e);
|
||||
detail::check_shift_range(val, mpl::bool_<(sizeof(Val) > sizeof(std::size_t))>(), mpl::bool_<boost::multiprecision::detail::is_signed<Val>::value && boost::multiprecision::detail::is_integral<Val>::value>());
|
||||
detail::check_shift_range(val, std::integral_constant<bool, (sizeof(Val) > sizeof(std::size_t))>(), std::integral_constant<bool, boost::multiprecision::detail::is_signed<Val>::value && boost::multiprecision::detail::is_integral<Val>::value>());
|
||||
eval_right_shift(m_backend, temp.backend(), static_cast<std::size_t>(val));
|
||||
}
|
||||
|
||||
@@ -1433,17 +1429,17 @@ class number
|
||||
static_assert(number_category<Backend>::value == number_kind_integer, "The left shift operation is only valid for integer types");
|
||||
using default_ops::eval_left_shift;
|
||||
self_type temp(e);
|
||||
detail::check_shift_range(val, mpl::bool_<(sizeof(Val) > sizeof(std::size_t))>(), mpl::bool_<boost::multiprecision::detail::is_signed<Val>::value && boost::multiprecision::detail::is_integral<Val>::value>());
|
||||
detail::check_shift_range(val, std::integral_constant<bool, (sizeof(Val) > sizeof(std::size_t))>(), std::integral_constant<bool, boost::multiprecision::detail::is_signed<Val>::value && boost::multiprecision::detail::is_integral<Val>::value>());
|
||||
eval_left_shift(m_backend, temp.backend(), static_cast<std::size_t>(val));
|
||||
}
|
||||
|
||||
template <class Exp>
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const mpl::int_<1>&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const std::integral_constant<int, 1>&)
|
||||
{
|
||||
e.left().value()(&m_backend);
|
||||
}
|
||||
template <class Exp>
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const mpl::int_<2>&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const std::integral_constant<int, 2>&)
|
||||
{
|
||||
typedef typename Exp::right_type right_type;
|
||||
typedef typename right_type::tag_type tag_type;
|
||||
@@ -1461,7 +1457,7 @@ class number
|
||||
f(m_backend, t.backend());
|
||||
}
|
||||
template <class Exp>
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const mpl::int_<3>&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const std::integral_constant<int, 3>&)
|
||||
{
|
||||
typedef typename Exp::middle_type middle_type;
|
||||
typedef typename middle_type::tag_type tag_type;
|
||||
@@ -1495,7 +1491,7 @@ class number
|
||||
}
|
||||
|
||||
template <class Exp>
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const mpl::int_<4>&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const std::integral_constant<int, 4>&)
|
||||
{
|
||||
typedef typename Exp::left_middle_type left_type;
|
||||
typedef typename left_type::tag_type left_tag_type;
|
||||
@@ -1900,25 +1896,25 @@ class number
|
||||
return contains_self(e, typename Exp::arity());
|
||||
}
|
||||
template <class Exp>
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, mpl::int_<0> const&) const BOOST_NOEXCEPT
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, std::integral_constant<int, 0> const&) const BOOST_NOEXCEPT
|
||||
{
|
||||
return is_realy_self(e.value());
|
||||
}
|
||||
template <class Exp>
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, mpl::int_<1> const&) const BOOST_NOEXCEPT
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, std::integral_constant<int, 1> const&) const BOOST_NOEXCEPT
|
||||
{
|
||||
typedef typename Exp::left_type child_type;
|
||||
return contains_self(e.left(), typename child_type::arity());
|
||||
}
|
||||
template <class Exp>
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, mpl::int_<2> const&) const BOOST_NOEXCEPT
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, std::integral_constant<int, 2> const&) const BOOST_NOEXCEPT
|
||||
{
|
||||
typedef typename Exp::left_type child0_type;
|
||||
typedef typename Exp::right_type child1_type;
|
||||
return contains_self(e.left(), typename child0_type::arity()) || contains_self(e.right(), typename child1_type::arity());
|
||||
}
|
||||
template <class Exp>
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, mpl::int_<3> const&) const BOOST_NOEXCEPT
|
||||
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, std::integral_constant<int, 3> const&) const BOOST_NOEXCEPT
|
||||
{
|
||||
typedef typename Exp::left_type child0_type;
|
||||
typedef typename Exp::middle_type child1_type;
|
||||
@@ -1933,12 +1929,12 @@ class number
|
||||
return is_self(e, typename Exp::arity());
|
||||
}
|
||||
template <class Exp>
|
||||
BOOST_MP_FORCEINLINE constexpr bool is_self(const Exp& e, mpl::int_<0> const&) const BOOST_NOEXCEPT
|
||||
BOOST_MP_FORCEINLINE constexpr bool is_self(const Exp& e, std::integral_constant<int, 0> const&) const BOOST_NOEXCEPT
|
||||
{
|
||||
return is_realy_self(e.value());
|
||||
}
|
||||
template <class Exp, int v>
|
||||
BOOST_MP_FORCEINLINE constexpr bool is_self(const Exp&, mpl::int_<v> const&) const BOOST_NOEXCEPT
|
||||
BOOST_MP_FORCEINLINE constexpr bool is_self(const Exp&, std::integral_constant<int, v> const&) const BOOST_NOEXCEPT
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ struct rational_adaptor
|
||||
const rational_type& data() const { return m_value; }
|
||||
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const mpl::true_&)
|
||||
void serialize(Archive& ar, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
// Saving
|
||||
integer_type n(m_value.numerator()), d(m_value.denominator());
|
||||
@@ -189,7 +189,7 @@ struct rational_adaptor
|
||||
ar& boost::make_nvp("denominator", d);
|
||||
}
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const mpl::false_&)
|
||||
void serialize(Archive& ar, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
// Loading
|
||||
integer_type n, d;
|
||||
@@ -201,7 +201,8 @@ struct rational_adaptor
|
||||
void serialize(Archive& ar, const unsigned int /*version*/)
|
||||
{
|
||||
typedef typename Archive::is_saving tag;
|
||||
serialize(ar, tag());
|
||||
typedef std::integral_constant<bool, tag::value> saving_tag;
|
||||
serialize(ar, saving_tag());
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -296,7 +297,7 @@ struct expression_template_default<backends::rational_adaptor<IntBackend> > : pu
|
||||
{};
|
||||
|
||||
template <class IntBackend>
|
||||
struct number_category<backends::rational_adaptor<IntBackend> > : public mpl::int_<number_kind_rational>
|
||||
struct number_category<backends::rational_adaptor<IntBackend> > : public std::integral_constant<int, number_kind_rational>
|
||||
{};
|
||||
|
||||
using boost::multiprecision::backends::rational_adaptor;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <boost/multiprecision/detail/integer_ops.hpp>
|
||||
#include <boost/math/special_functions/fpclassify.hpp>
|
||||
#include <cstdint>
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/functional/hash_fwd.hpp>
|
||||
#include <tommath.h>
|
||||
#include <cctype>
|
||||
@@ -43,9 +42,9 @@ void eval_add(tommath_int& t, const tommath_int& o);
|
||||
|
||||
struct tommath_int
|
||||
{
|
||||
typedef mpl::list<std::int32_t, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<std::uint32_t, boost::ulong_long_type> unsigned_types;
|
||||
typedef mpl::list<long double> float_types;
|
||||
typedef std::tuple<std::int32_t, boost::long_long_type> signed_types;
|
||||
typedef std::tuple<std::uint32_t, boost::ulong_long_type> unsigned_types;
|
||||
typedef std::tuple<long double> float_types;
|
||||
|
||||
tommath_int()
|
||||
{
|
||||
@@ -391,7 +390,7 @@ struct tommath_int
|
||||
std::size_t s;
|
||||
detail::check_tommath_result(mp_radix_size(const_cast< ::mp_int*>(&m_data), base, &s));
|
||||
#endif
|
||||
boost::scoped_array<char> a(new char[s + 1]);
|
||||
std::unique_ptr<char[]> a(new char[s + 1]);
|
||||
#ifdef DIGIT_BIT
|
||||
detail::check_tommath_result(mp_toradix_n(const_cast< ::mp_int*>(&m_data), a.get(), base, s + 1));
|
||||
#else
|
||||
@@ -779,7 +778,7 @@ inline std::size_t hash_value(const tommath_int& val)
|
||||
using boost::multiprecision::backends::tommath_int;
|
||||
|
||||
template <>
|
||||
struct number_category<tommath_int> : public mpl::int_<number_kind_integer>
|
||||
struct number_category<tommath_int> : public std::integral_constant<int, number_kind_integer>
|
||||
{};
|
||||
|
||||
typedef number<tommath_int> tom_int;
|
||||
|
||||
@@ -6,14 +6,37 @@
|
||||
#ifndef BOOST_MP_IS_BACKEND_HPP
|
||||
#define BOOST_MP_IS_BACKEND_HPP
|
||||
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
#include <boost/multiprecision/detail/number_base.hpp>
|
||||
|
||||
namespace boost { namespace multiprecision { namespace detail {
|
||||
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(signed_types)
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(unsigned_types)
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(float_types)
|
||||
template <class T>
|
||||
struct has_signed_types
|
||||
{
|
||||
template <class U>
|
||||
static double check(U*, typename U::signed_types* = 0);
|
||||
static char check(...);
|
||||
static T* get();
|
||||
static constexpr bool value = sizeof(check(get())) == sizeof(double);
|
||||
};
|
||||
template <class T>
|
||||
struct has_unsigned_types
|
||||
{
|
||||
template <class U>
|
||||
static double check(U*, typename U::unsigned_types* = 0);
|
||||
static char check(...);
|
||||
static T* get();
|
||||
static constexpr bool value = sizeof(check(get())) == sizeof(double);
|
||||
};
|
||||
template <class T>
|
||||
struct has_float_types
|
||||
{
|
||||
template <class U>
|
||||
static double check(U*, typename U::float_types* = 0);
|
||||
static char check(...);
|
||||
static T* get();
|
||||
static constexpr bool value = sizeof(check(get())) == sizeof(double);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_backend
|
||||
|
||||
@@ -8,11 +8,19 @@
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
|
||||
namespace boost { namespace multiprecision { namespace detail {
|
||||
|
||||
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_member_const_iterator, const_iterator, false)
|
||||
template <class T>
|
||||
struct has_member_const_iterator
|
||||
{
|
||||
template <class U>
|
||||
static double check(U*, typename U::const_iterator* = 0);
|
||||
static char check(...);
|
||||
static T* get();
|
||||
static constexpr bool value = sizeof(check(get())) == sizeof(double);
|
||||
};
|
||||
|
||||
|
||||
template <class C, bool b>
|
||||
struct is_byte_container_imp
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define BOOST_MP_RESTRICTED_CONVERSION_HPP
|
||||
|
||||
#include <boost/multiprecision/traits/explicit_conversion.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/multiprecision/detail/number_base.hpp>
|
||||
|
||||
namespace boost { namespace multiprecision { namespace detail {
|
||||
@@ -20,8 +19,8 @@ struct is_lossy_conversion
|
||||
((number_category<From>::value == number_kind_floating_point) && (number_category<To>::value == number_kind_integer))
|
||||
/* || ((number_category<From>::value == number_kind_floating_point) && (number_category<To>::value == number_kind_rational))*/
|
||||
|| ((number_category<From>::value == number_kind_rational) && (number_category<To>::value == number_kind_integer)) || ((number_category<From>::value == number_kind_fixed_point) && (number_category<To>::value == number_kind_integer)) || (number_category<From>::value == number_kind_unknown) || (number_category<To>::value == number_kind_unknown),
|
||||
mpl::true_,
|
||||
mpl::false_>::type type;
|
||||
std::integral_constant<bool, true>,
|
||||
std::integral_constant<bool, false>>::type type;
|
||||
static const bool value = type::value;
|
||||
};
|
||||
|
||||
@@ -30,8 +29,8 @@ struct is_restricted_conversion
|
||||
{
|
||||
typedef typename std::conditional<
|
||||
((is_explicitly_convertible<From, To>::value && !std::is_convertible<From, To>::value) || is_lossy_conversion<From, To>::value),
|
||||
mpl::true_,
|
||||
mpl::false_>::type type;
|
||||
std::integral_constant<bool, true>,
|
||||
std::integral_constant<bool, false>>::type type;
|
||||
static const bool value = type::value;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace backends {
|
||||
template <class Arithmetic>
|
||||
struct arithmetic_backend
|
||||
{
|
||||
typedef mpl::list<short, int, long, long long> signed_types;
|
||||
typedef mpl::list<unsigned short, unsigned, unsigned long, unsigned long long> unsigned_types;
|
||||
typedef mpl::list<float, double, long double> float_types;
|
||||
typedef std::tuple<short, int, long, long long> signed_types;
|
||||
typedef std::tuple<unsigned short, unsigned, unsigned long, unsigned long long> unsigned_types;
|
||||
typedef std::tuple<float, double, long double> float_types;
|
||||
typedef int exponent_type;
|
||||
|
||||
BOOST_MP_CXX14_CONSTEXPR arithmetic_backend() : m_value(0) {}
|
||||
@@ -83,17 +83,17 @@ struct arithmetic_backend
|
||||
ss << std::setprecision(digits ? digits : std::numeric_limits<Arithmetic>::digits10 + 4) << m_value;
|
||||
return ss.str();
|
||||
}
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_negate(const mpl::true_&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_negate(const std::integral_constant<bool, true>&)
|
||||
{
|
||||
m_value = 1 + ~m_value;
|
||||
}
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_negate(const mpl::false_&)
|
||||
BOOST_MP_CXX14_CONSTEXPR void do_negate(const std::integral_constant<bool, false>&)
|
||||
{
|
||||
m_value = -m_value;
|
||||
}
|
||||
BOOST_MP_CXX14_CONSTEXPR void negate()
|
||||
{
|
||||
do_negate(mpl::bool_<boost::multiprecision::detail::is_unsigned<Arithmetic>::value>());
|
||||
do_negate(std::integral_constant<bool, boost::multiprecision::detail::is_unsigned<Arithmetic>::value>());
|
||||
}
|
||||
BOOST_MP_CXX14_CONSTEXPR int compare(const arithmetic_backend& o) const
|
||||
{
|
||||
@@ -549,7 +549,7 @@ inline BOOST_MP_CXX14_CONSTEXPR std::size_t hash_value(const arithmetic_backend<
|
||||
using boost::multiprecision::backends::arithmetic_backend;
|
||||
|
||||
template <class Arithmetic>
|
||||
struct number_category<arithmetic_backend<Arithmetic> > : public mpl::int_<boost::multiprecision::detail::is_integral<Arithmetic>::value ? number_kind_integer : number_kind_floating_point>
|
||||
struct number_category<arithmetic_backend<Arithmetic> > : public std::integral_constant<int, boost::multiprecision::detail::is_integral<Arithmetic>::value ? number_kind_integer : number_kind_floating_point>
|
||||
{};
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -47,7 +47,7 @@ std::ostream& operator<<(std::ostream& os, const __float128& f)
|
||||
namespace boost {
|
||||
|
||||
template <>
|
||||
struct has_left_shift<std::basic_ostream<char>, __float128> : public mpl::true_
|
||||
struct has_left_shift<std::basic_ostream<char>, __float128> : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -484,9 +484,9 @@ struct tester
|
||||
private:
|
||||
T generate_random()
|
||||
{
|
||||
return generate_random(boost::mpl::int_<Type>());
|
||||
return generate_random(std::integral_constant<int, Type>());
|
||||
}
|
||||
T generate_random(const boost::mpl::int_<boost::multiprecision::number_kind_floating_point>&)
|
||||
T generate_random(const std::integral_constant<int, boost::multiprecision::number_kind_floating_point>&)
|
||||
{
|
||||
T val = gen();
|
||||
T prev_val = -1;
|
||||
@@ -503,7 +503,7 @@ struct tester
|
||||
static boost::random::uniform_int_distribution<e_type> ui(-30, 30);
|
||||
return ldexp(val, static_cast<int>(ui(gen)));
|
||||
}
|
||||
T generate_random(const boost::mpl::int_<boost::multiprecision::number_kind_integer>&)
|
||||
T generate_random(const std::integral_constant<int, boost::multiprecision::number_kind_integer>&)
|
||||
{
|
||||
typedef boost::random::mt19937::result_type random_type;
|
||||
|
||||
@@ -535,7 +535,7 @@ struct tester
|
||||
val %= max_val;
|
||||
return val;
|
||||
}
|
||||
T generate_random(const boost::mpl::int_<boost::multiprecision::number_kind_rational>&)
|
||||
T generate_random(const std::integral_constant<int, boost::multiprecision::number_kind_rational>&)
|
||||
{
|
||||
typedef boost::random::mt19937::result_type random_type;
|
||||
typedef typename boost::multiprecision::component_type<T>::type IntType;
|
||||
@@ -584,15 +584,15 @@ struct tester
|
||||
template <class N, int V>
|
||||
boost::random::mt19937 tester<N, V>::gen;
|
||||
|
||||
inline const char* category_name(const boost::mpl::int_<boost::multiprecision::number_kind_integer>&)
|
||||
inline const char* category_name(const std::integral_constant<int, boost::multiprecision::number_kind_integer>&)
|
||||
{
|
||||
return "integer";
|
||||
}
|
||||
inline const char* category_name(const boost::mpl::int_<boost::multiprecision::number_kind_floating_point>&)
|
||||
inline const char* category_name(const std::integral_constant<int, boost::multiprecision::number_kind_floating_point>&)
|
||||
{
|
||||
return "float";
|
||||
}
|
||||
inline const char* category_name(const boost::mpl::int_<boost::multiprecision::number_kind_rational>&)
|
||||
inline const char* category_name(const std::integral_constant<int, boost::multiprecision::number_kind_rational>&)
|
||||
{
|
||||
return "rational";
|
||||
}
|
||||
@@ -614,7 +614,7 @@ inline void report_result(const char* cat, const char* type, const char* op, uns
|
||||
}
|
||||
|
||||
template <class Number, int N>
|
||||
void test_int_ops(tester<Number, N>& t, const char* type, unsigned precision, const boost::mpl::int_<boost::multiprecision::number_kind_integer>&)
|
||||
void test_int_ops(tester<Number, N>& t, const char* type, unsigned precision, const std::integral_constant<int, boost::multiprecision::number_kind_integer>&)
|
||||
{
|
||||
const char* cat = "integer";
|
||||
report_result(cat, type, "%", precision, t.test_mod());
|
||||
|
||||
@@ -43,9 +43,9 @@ struct skeleton_backend
|
||||
// present in the list will get promoted to the next wider type that is
|
||||
// in the list whenever mixed arithmetic involving that type is encountered.
|
||||
//
|
||||
typedef mpl::list</*signed char, short, int, long,*/ long long> signed_types;
|
||||
typedef mpl::list</* unsigned char, unsigned short, unsigned, unsigned long,*/ unsigned long long> unsigned_types;
|
||||
typedef mpl::list</*float, double,*/ long double> float_types;
|
||||
typedef std::tuple</*signed char, short, int, long,*/ long long> signed_types;
|
||||
typedef std::tuple</* unsigned char, unsigned short, unsigned, unsigned long,*/ unsigned long long> unsigned_types;
|
||||
typedef std::tuple</*float, double,*/ long double> float_types;
|
||||
//
|
||||
// This typedef is only required if this is a floating point type, it is the type
|
||||
// which holds the exponent:
|
||||
@@ -1088,7 +1088,7 @@ typedef number<skeleton_backend, et_off> skeleton_number;
|
||||
// number_kind_complex
|
||||
//
|
||||
template<>
|
||||
struct number_category<skeleton_backend > : public mpl::int_<number_kind_floating_point>
|
||||
struct number_category<skeleton_backend > : public std::integral_constant<int, number_kind_floating_point>
|
||||
{};
|
||||
|
||||
//
|
||||
|
||||
@@ -66,7 +66,7 @@ T generate_random(unsigned bits_wanted)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_neg(const T& x, const boost::mpl::true_&)
|
||||
void test_neg(const T& x, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
T val = -x;
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
@@ -115,7 +115,7 @@ void test_neg(const T& x, const boost::mpl::true_&)
|
||||
#endif
|
||||
}
|
||||
template <class T>
|
||||
void test_neg(const T&, const boost::mpl::false_&) {}
|
||||
void test_neg(const T&, const std::integral_constant<bool, false>&) {}
|
||||
|
||||
template <class T>
|
||||
void test()
|
||||
@@ -173,7 +173,7 @@ void test()
|
||||
std::cout << e.what() << std::endl;
|
||||
}
|
||||
#endif
|
||||
test_neg(val, boost::mpl::bool_<std::numeric_limits<T>::is_signed>());
|
||||
test_neg(val, std::integral_constant<bool, std::numeric_limits<T>::is_signed>());
|
||||
//
|
||||
// Check to see if test is taking too long.
|
||||
// Tests run on the compiler farm time out after 300 seconds,
|
||||
|
||||
+48
-48
@@ -14,10 +14,10 @@
|
||||
#include "test.hpp"
|
||||
|
||||
template <class T>
|
||||
struct is_boost_rational : public boost::mpl::false_
|
||||
struct is_boost_rational : public std::integral_constant<bool, false>
|
||||
{};
|
||||
template <class T>
|
||||
struct is_checked_cpp_int : public boost::mpl::false_
|
||||
struct is_checked_cpp_int : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
@@ -63,7 +63,7 @@ abs(boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4> const
|
||||
} // namespace detail
|
||||
|
||||
template <class T>
|
||||
struct is_twos_complement_integer : public boost::mpl::true_
|
||||
struct is_twos_complement_integer : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
@@ -229,7 +229,7 @@ void test_conditional(Real v, Exp e)
|
||||
}
|
||||
|
||||
template <class Real>
|
||||
void test_complement(Real a, Real b, Real c, const boost::mpl::true_&)
|
||||
void test_complement(Real a, Real b, Real c, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
int i = 1020304;
|
||||
int j = 56789123;
|
||||
@@ -249,7 +249,7 @@ void test_complement(Real a, Real b, Real c, const boost::mpl::true_&)
|
||||
}
|
||||
|
||||
template <class Real>
|
||||
void test_complement(Real, Real, Real, const boost::mpl::false_&)
|
||||
void test_complement(Real, Real, Real, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ template <class Real, class T>
|
||||
void test_integer_ops(const T&) {}
|
||||
|
||||
template <class Real>
|
||||
void test_rational(const boost::mpl::true_&)
|
||||
void test_rational(const std::integral_constant<bool, true>&)
|
||||
{
|
||||
Real a(2);
|
||||
a /= 3;
|
||||
@@ -277,7 +277,7 @@ void test_rational(const boost::mpl::true_&)
|
||||
}
|
||||
|
||||
template <class Real>
|
||||
void test_rational(const boost::mpl::false_&)
|
||||
void test_rational(const std::integral_constant<bool, false>&)
|
||||
{
|
||||
Real a(2);
|
||||
a /= 3;
|
||||
@@ -303,13 +303,13 @@ void test_rational(const boost::mpl::false_&)
|
||||
}
|
||||
|
||||
template <class Real>
|
||||
void test_integer_ops(const boost::mpl::int_<boost::multiprecision::number_kind_rational>&)
|
||||
void test_integer_ops(const std::integral_constant<int, boost::multiprecision::number_kind_rational>&)
|
||||
{
|
||||
test_rational<Real>(is_boost_rational<Real>());
|
||||
}
|
||||
|
||||
template <class Real>
|
||||
void test_signed_integer_ops(const boost::mpl::true_&)
|
||||
void test_signed_integer_ops(const std::integral_constant<bool, true>&)
|
||||
{
|
||||
Real a(20);
|
||||
Real b(7);
|
||||
@@ -434,17 +434,17 @@ void test_signed_integer_ops(const boost::mpl::true_&)
|
||||
#endif
|
||||
}
|
||||
template <class Real>
|
||||
void test_signed_integer_ops(const boost::mpl::false_&)
|
||||
void test_signed_integer_ops(const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Real>
|
||||
inline Real negate_if_signed(Real r, const boost::mpl::bool_<true>&)
|
||||
inline Real negate_if_signed(Real r, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
return -r;
|
||||
}
|
||||
template <class Real>
|
||||
inline Real negate_if_signed(Real r, const boost::mpl::bool_<false>&)
|
||||
inline Real negate_if_signed(Real r, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
return r;
|
||||
}
|
||||
@@ -506,7 +506,7 @@ void test_integer_overflow()
|
||||
m = 2u;
|
||||
m = pow(m, (std::min)(std::numeric_limits<Real>::digits - 1, 1000));
|
||||
++m;
|
||||
m = negate_if_signed(m, boost::mpl::bool_<std::numeric_limits<Real>::is_signed>());
|
||||
m = negate_if_signed(m, std::integral_constant<bool, std::numeric_limits<Real>::is_signed>());
|
||||
if (is_checked_cpp_int<Real>::value)
|
||||
{
|
||||
BOOST_CHECK_THROW(m.template convert_to<Int>(), std::overflow_error);
|
||||
@@ -522,12 +522,12 @@ void test_integer_overflow()
|
||||
// signed to unsigned converison with overflow, it's really not clear what should happen here!
|
||||
m = (std::numeric_limits<Int>::max)();
|
||||
++m;
|
||||
m = negate_if_signed(m, boost::mpl::bool_<std::numeric_limits<Real>::is_signed>());
|
||||
m = negate_if_signed(m, std::integral_constant<bool, std::numeric_limits<Real>::is_signed>());
|
||||
BOOST_CHECK_THROW(m.template convert_to<Int>(), std::range_error);
|
||||
// Again with much larger value:
|
||||
m = 2u;
|
||||
m = pow(m, (std::min)(std::numeric_limits<Real>::digits - 1, 1000));
|
||||
m = negate_if_signed(m, boost::mpl::bool_<std::numeric_limits<Real>::is_signed>());
|
||||
m = negate_if_signed(m, std::integral_constant<bool, std::numeric_limits<Real>::is_signed>());
|
||||
BOOST_CHECK_THROW(m.template convert_to<Int>(), std::range_error);
|
||||
}
|
||||
}
|
||||
@@ -552,9 +552,9 @@ void test_integer_round_trip()
|
||||
}
|
||||
|
||||
template <class Real>
|
||||
void test_integer_ops(const boost::mpl::int_<boost::multiprecision::number_kind_integer>&)
|
||||
void test_integer_ops(const std::integral_constant<int, boost::multiprecision::number_kind_integer>&)
|
||||
{
|
||||
test_signed_integer_ops<Real>(boost::mpl::bool_<std::numeric_limits<Real>::is_signed>());
|
||||
test_signed_integer_ops<Real>(std::integral_constant<bool, std::numeric_limits<Real>::is_signed>());
|
||||
|
||||
Real a(20);
|
||||
Real b(7);
|
||||
@@ -958,7 +958,7 @@ template <class Real, class T>
|
||||
void test_float_funcs(const T&) {}
|
||||
|
||||
template <class Real>
|
||||
void test_float_funcs(const boost::mpl::true_&)
|
||||
void test_float_funcs(const std::integral_constant<bool, true>&)
|
||||
{
|
||||
if (boost::multiprecision::is_interval_number<Real>::value)
|
||||
return;
|
||||
@@ -1198,7 +1198,7 @@ template <class Real, class T>
|
||||
void test_float_ops(const T&) {}
|
||||
|
||||
template <class Real>
|
||||
void test_float_ops(const boost::mpl::int_<boost::multiprecision::number_kind_floating_point>&)
|
||||
void test_float_ops(const std::integral_constant<int, boost::multiprecision::number_kind_floating_point>&)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(abs(Real(2)), 2);
|
||||
BOOST_CHECK_EQUAL(abs(Real(-2)), 2);
|
||||
@@ -1423,7 +1423,7 @@ void test_float_ops(const boost::mpl::int_<boost::multiprecision::number_kind_fl
|
||||
}
|
||||
}
|
||||
|
||||
test_float_funcs<Real>(boost::mpl::bool_<std::numeric_limits<Real>::is_specialized>());
|
||||
test_float_funcs<Real>(std::integral_constant<bool, std::numeric_limits<Real>::is_specialized>());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -1439,7 +1439,7 @@ struct lexical_cast_target_type
|
||||
};
|
||||
|
||||
template <class Real, class Num>
|
||||
void test_negative_mixed_minmax(boost::mpl::true_ const&)
|
||||
void test_negative_mixed_minmax(std::integral_constant<bool, true> const&)
|
||||
{
|
||||
if (!std::numeric_limits<Real>::is_bounded || (std::numeric_limits<Real>::digits >= std::numeric_limits<Num>::digits))
|
||||
{
|
||||
@@ -1466,12 +1466,12 @@ void test_negative_mixed_minmax(boost::mpl::true_ const&)
|
||||
}
|
||||
}
|
||||
template <class Real, class Num>
|
||||
void test_negative_mixed_minmax(boost::mpl::false_ const&)
|
||||
void test_negative_mixed_minmax(std::integral_constant<bool, false> const&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Real, class Num>
|
||||
void test_negative_mixed_numeric_limits(boost::mpl::true_ const&)
|
||||
void test_negative_mixed_numeric_limits(std::integral_constant<bool, true> const&)
|
||||
{
|
||||
typedef typename lexical_cast_target_type<Num>::type target_type;
|
||||
#if defined(TEST_MPFR)
|
||||
@@ -1498,10 +1498,10 @@ void test_negative_mixed_numeric_limits(boost::mpl::true_ const&)
|
||||
}
|
||||
|
||||
template <class Real, class Num>
|
||||
void test_negative_mixed_numeric_limits(boost::mpl::false_ const&) {}
|
||||
void test_negative_mixed_numeric_limits(std::integral_constant<bool, false> const&) {}
|
||||
|
||||
template <class Real, class Num>
|
||||
void test_negative_mixed(boost::mpl::true_ const&)
|
||||
void test_negative_mixed(std::integral_constant<bool, true> const&)
|
||||
{
|
||||
typedef typename std::conditional<
|
||||
std::is_convertible<Num, Real>::value,
|
||||
@@ -1552,7 +1552,7 @@ void test_negative_mixed(boost::mpl::true_ const&)
|
||||
BOOST_CHECK_EQUAL(static_cast<Num>((Real(n2) + 0)), n2);
|
||||
BOOST_CHECK_EQUAL(static_cast<Num>((Real(n3) + 0)), n3);
|
||||
BOOST_CHECK_EQUAL(static_cast<Num>((Real(n4) + 0)), n4);
|
||||
test_negative_mixed_numeric_limits<Real, Num>(boost::mpl::bool_<std::numeric_limits<Real>::is_specialized>());
|
||||
test_negative_mixed_numeric_limits<Real, Num>(std::integral_constant<bool, std::numeric_limits<Real>::is_specialized>());
|
||||
// Assignment:
|
||||
Real r(0);
|
||||
BOOST_CHECK(r != static_cast<cast_type>(n1));
|
||||
@@ -1768,7 +1768,7 @@ void test_negative_mixed(boost::mpl::true_ const&)
|
||||
//
|
||||
// Conversion from min and max values:
|
||||
//
|
||||
test_negative_mixed_minmax<Real, Num>(boost::mpl::bool_ < std::numeric_limits<Real>::is_integer && std::numeric_limits<Num>::is_integer > ());
|
||||
test_negative_mixed_minmax<Real, Num>(std::integral_constant<bool, std::numeric_limits<Real>::is_integer && std::numeric_limits<Num>::is_integer > ());
|
||||
//
|
||||
// RValue ref overloads:
|
||||
//
|
||||
@@ -1794,38 +1794,38 @@ void test_negative_mixed(boost::mpl::true_ const&)
|
||||
}
|
||||
|
||||
template <class Real, class Num>
|
||||
void test_negative_mixed(boost::mpl::false_ const&)
|
||||
void test_negative_mixed(std::integral_constant<bool, false> const&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Real, class Num>
|
||||
void test_mixed(const boost::mpl::false_&)
|
||||
void test_mixed(const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Real>
|
||||
inline bool check_is_nan(const Real& val, const boost::mpl::true_&)
|
||||
inline bool check_is_nan(const Real& val, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
return (boost::math::isnan)(val);
|
||||
}
|
||||
template <class Real>
|
||||
inline bool check_is_nan(const Real&, const boost::mpl::false_&)
|
||||
inline bool check_is_nan(const Real&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
template <class Real>
|
||||
inline Real negate_value(const Real& val, const boost::mpl::true_&)
|
||||
inline Real negate_value(const Real& val, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
return -val;
|
||||
}
|
||||
template <class Real>
|
||||
inline Real negate_value(const Real& val, const boost::mpl::false_&)
|
||||
inline Real negate_value(const Real& val, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
template <class Real, class Num>
|
||||
void test_mixed_numeric_limits(const boost::mpl::true_&)
|
||||
void test_mixed_numeric_limits(const std::integral_constant<bool, true>&)
|
||||
{
|
||||
typedef typename lexical_cast_target_type<Num>::type target_type;
|
||||
#if defined(TEST_MPFR)
|
||||
@@ -1839,15 +1839,15 @@ void test_mixed_numeric_limits(const boost::mpl::true_&)
|
||||
{
|
||||
d = static_cast<Real>(std::numeric_limits<Num>::infinity());
|
||||
BOOST_CHECK_GT(d, (std::numeric_limits<Real>::max)());
|
||||
d = static_cast<Real>(negate_value(std::numeric_limits<Num>::infinity(), boost::mpl::bool_<std::numeric_limits<Num>::is_signed>()));
|
||||
BOOST_CHECK_LT(d, negate_value((std::numeric_limits<Real>::max)(), boost::mpl::bool_<std::numeric_limits<Real>::is_signed>()));
|
||||
d = static_cast<Real>(negate_value(std::numeric_limits<Num>::infinity(), std::integral_constant<bool, std::numeric_limits<Num>::is_signed>()));
|
||||
BOOST_CHECK_LT(d, negate_value((std::numeric_limits<Real>::max)(), std::integral_constant<bool, std::numeric_limits<Real>::is_signed>()));
|
||||
}
|
||||
if (std::numeric_limits<Real>::has_quiet_NaN && std::numeric_limits<Num>::has_quiet_NaN)
|
||||
{
|
||||
d = static_cast<Real>(std::numeric_limits<Num>::quiet_NaN());
|
||||
BOOST_CHECK(check_is_nan(d, boost::mpl::bool_<std::numeric_limits<Real>::has_quiet_NaN>()));
|
||||
d = static_cast<Real>(negate_value(std::numeric_limits<Num>::quiet_NaN(), boost::mpl::bool_<std::numeric_limits<Num>::is_signed>()));
|
||||
BOOST_CHECK(check_is_nan(d, boost::mpl::bool_<std::numeric_limits<Real>::has_quiet_NaN>()));
|
||||
BOOST_CHECK(check_is_nan(d, std::integral_constant<bool, std::numeric_limits<Real>::has_quiet_NaN>()));
|
||||
d = static_cast<Real>(negate_value(std::numeric_limits<Num>::quiet_NaN(), std::integral_constant<bool, std::numeric_limits<Num>::is_signed>()));
|
||||
BOOST_CHECK(check_is_nan(d, std::integral_constant<bool, std::numeric_limits<Real>::has_quiet_NaN>()));
|
||||
}
|
||||
|
||||
static const int left_shift = std::numeric_limits<Num>::digits - 1;
|
||||
@@ -1869,12 +1869,12 @@ void test_mixed_numeric_limits(const boost::mpl::true_&)
|
||||
BOOST_CHECK_CLOSE(n4, checked_lexical_cast<target_type>(Real(n4).str(digits_to_print, f)), 0);
|
||||
}
|
||||
template <class Real, class Num>
|
||||
void test_mixed_numeric_limits(const boost::mpl::false_&)
|
||||
void test_mixed_numeric_limits(const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Real, class Num>
|
||||
void test_mixed(const boost::mpl::true_&)
|
||||
void test_mixed(const std::integral_constant<bool, true>&)
|
||||
{
|
||||
typedef typename std::conditional<
|
||||
std::is_convertible<Num, Real>::value,
|
||||
@@ -1976,7 +1976,7 @@ void test_mixed(const boost::mpl::true_&)
|
||||
r = static_cast<cast_type>(Num(4) * n4) / Real(4);
|
||||
BOOST_CHECK_EQUAL(r, static_cast<cast_type>(n4));
|
||||
|
||||
typedef boost::mpl::bool_<
|
||||
typedef std::integral_constant<bool,
|
||||
(!std::numeric_limits<Num>::is_specialized || std::numeric_limits<Num>::is_signed) && (!std::numeric_limits<Real>::is_specialized || std::numeric_limits<Real>::is_signed)>
|
||||
signed_tag;
|
||||
|
||||
@@ -2053,7 +2053,7 @@ void test_mixed(const boost::mpl::true_&)
|
||||
d = b * static_cast<cast_type>(n3) - static_cast<cast_type>(n1);
|
||||
BOOST_CHECK_EQUAL(d, 3 * 4 - 2);
|
||||
|
||||
test_mixed_numeric_limits<Real, Num>(boost::mpl::bool_<std::numeric_limits<Real>::is_specialized>());
|
||||
test_mixed_numeric_limits<Real, Num>(std::integral_constant<bool, std::numeric_limits<Real>::is_specialized>());
|
||||
}
|
||||
|
||||
template <class Real>
|
||||
@@ -2535,7 +2535,7 @@ void test_members(boost::rational<Real>)
|
||||
}
|
||||
|
||||
template <class Real>
|
||||
void test_signed_ops(const boost::mpl::true_&)
|
||||
void test_signed_ops(const std::integral_constant<bool, true>&)
|
||||
{
|
||||
Real a(8);
|
||||
Real b(64);
|
||||
@@ -2639,7 +2639,7 @@ void test_signed_ops(const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(c, -2);
|
||||
}
|
||||
template <class Real>
|
||||
void test_signed_ops(const boost::mpl::false_&)
|
||||
void test_signed_ops(const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2857,11 +2857,11 @@ void test()
|
||||
test_mixed<Real, long double>(tag);
|
||||
|
||||
typedef typename related_type<Real>::type related_type;
|
||||
boost::mpl::bool_<boost::multiprecision::is_number<Real>::value && !std::is_same<related_type, Real>::value> tag2;
|
||||
std::integral_constant<bool, boost::multiprecision::is_number<Real>::value && !std::is_same<related_type, Real>::value> tag2;
|
||||
|
||||
test_mixed<Real, related_type>(tag2);
|
||||
|
||||
boost::mpl::bool_<boost::multiprecision::is_number<Real>::value && (boost::multiprecision::number_category<Real>::value == boost::multiprecision::number_kind_complex)> complex_tag;
|
||||
std::integral_constant<bool, boost::multiprecision::is_number<Real>::value && (boost::multiprecision::number_category<Real>::value == boost::multiprecision::number_kind_complex)> complex_tag;
|
||||
test_mixed<Real, std::complex<float> >(complex_tag);
|
||||
test_mixed<Real, std::complex<double> >(complex_tag);
|
||||
test_mixed<Real, std::complex<long double> >(complex_tag);
|
||||
@@ -3136,7 +3136,7 @@ void test()
|
||||
test_conditional(a, +a);
|
||||
test_conditional(a, (a + 0));
|
||||
|
||||
test_signed_ops<Real>(boost::mpl::bool_<std::numeric_limits<Real>::is_signed>());
|
||||
test_signed_ops<Real>(std::integral_constant<bool, std::numeric_limits<Real>::is_signed>());
|
||||
//
|
||||
// Test hashing:
|
||||
//
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ET>
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public boost::mpl::true_
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ET>
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public boost::mpl::true_
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ET>
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public boost::mpl::true_
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ET>
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public boost::mpl::true_
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ET>
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public boost::mpl::true_
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
@@ -23,7 +23,7 @@ struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, 64, boost::multiprecision::unsigned_magnitude, boost::multiprecision::checked, void> > > : public boost::mpl::true_
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, 64, boost::multiprecision::unsigned_magnitude, boost::multiprecision::checked, void> > > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
int main()
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ET>
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public boost::mpl::true_
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
int main()
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
@@ -25,7 +25,7 @@ struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_checked_cpp_int<boost::multiprecision::checked_cpp_int> : public boost::mpl::true_
|
||||
struct is_checked_cpp_int<boost::multiprecision::checked_cpp_int> : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
int main()
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ET>
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public boost::mpl::true_
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
@@ -23,7 +23,7 @@ struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_checked_cpp_int<boost::multiprecision::checked_uint1024_t> : public boost::mpl::true_
|
||||
struct is_checked_cpp_int<boost::multiprecision::checked_uint1024_t> : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
int main()
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
#include <boost/rational.hpp>
|
||||
|
||||
template <class T>
|
||||
struct is_boost_rational<boost::rational<T> > : public boost::mpl::true_
|
||||
struct is_boost_rational<boost::rational<T> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
namespace boost { namespace multiprecision {
|
||||
|
||||
template <>
|
||||
struct number_category<rational<mpz_int> > : public mpl::int_<number_kind_rational>
|
||||
struct number_category<rational<mpz_int> > : public std::integral_constant<int, number_kind_rational>
|
||||
{};
|
||||
|
||||
}} // namespace boost::multiprecision
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <>
|
||||
struct is_twos_complement_integer<boost::multiprecision::tom_int> : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::tom_int> : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
int main()
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
#include <boost/rational.hpp>
|
||||
|
||||
template <class T>
|
||||
struct is_boost_rational<boost::rational<T> > : public boost::mpl::true_
|
||||
struct is_boost_rational<boost::rational<T> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
namespace boost { namespace multiprecision {
|
||||
|
||||
template <>
|
||||
struct number_category<rational<tom_int> > : public mpl::int_<number_kind_rational>
|
||||
struct number_category<rational<tom_int> > : public std::integral_constant<int, number_kind_rational>
|
||||
{};
|
||||
|
||||
}} // namespace boost::multiprecision
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "test_arithmetic.hpp"
|
||||
|
||||
template <>
|
||||
struct is_twos_complement_integer<boost::multiprecision::tom_int> : public boost::mpl::false_
|
||||
struct is_twos_complement_integer<boost::multiprecision::tom_int> : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
int main()
|
||||
|
||||
+2
-2
@@ -74,12 +74,12 @@ T atan2_def(T y, T x)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct is_mpfr_type : public boost::mpl::false_
|
||||
struct is_mpfr_type : public std::integral_constant<bool, false>
|
||||
{};
|
||||
|
||||
#ifdef TEST_MPFR_50
|
||||
template <unsigned Digits10>
|
||||
struct is_mpfr_type<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10> > > : public boost::mpl::true_
|
||||
struct is_mpfr_type<boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<Digits10> > > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ T generate_random(unsigned bits_wanted)
|
||||
}
|
||||
|
||||
template <class Number>
|
||||
void test_signed_overflow(Number a, Number b, const boost::mpl::true_&)
|
||||
void test_signed_overflow(Number a, Number b, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
a = -a;
|
||||
BOOST_CHECK_THROW(Number(a * b), std::overflow_error);
|
||||
@@ -60,7 +60,7 @@ void test_signed_overflow(Number a, Number b, const boost::mpl::true_&)
|
||||
BOOST_CHECK(Number(a * b) >= (std::numeric_limits<Number>::min)());
|
||||
}
|
||||
template <class Number>
|
||||
void test_signed_overflow(Number, Number, const boost::mpl::false_&)
|
||||
void test_signed_overflow(Number, Number, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ void test()
|
||||
val = static_cast<test_type>(generate_random<cpp_int>(bits));
|
||||
test_type val2 = 1 + (std::numeric_limits<test_type>::max)() / val;
|
||||
BOOST_CHECK_THROW(test_type(val2 * val), std::overflow_error);
|
||||
test_signed_overflow(val2, val, boost::mpl::bool_<std::numeric_limits<test_type>::is_signed>());
|
||||
test_signed_overflow(val2, val, std::integral_constant<bool, std::numeric_limits<test_type>::is_signed>());
|
||||
--val2;
|
||||
BOOST_CHECK(cpp_int(val2) * cpp_int(val) <= cpp_int((std::numeric_limits<test_type>::max)()));
|
||||
BOOST_CHECK(val2 * val <= (std::numeric_limits<test_type>::max)());
|
||||
|
||||
@@ -70,7 +70,7 @@ T generate_random()
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_int(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -79,12 +79,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t4));
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_int(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_integer> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_integer> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -93,12 +93,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t1));
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t2));
|
||||
test_convert_neg_int<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_int<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_rat(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -107,12 +107,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(From(t4), from);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_rat_int(From const&, const boost::mpl::false_&)
|
||||
void test_convert_rat_int(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_rational> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_rational> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -121,12 +121,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(From(t1), from);
|
||||
BOOST_CHECK_EQUAL(From(t2), from);
|
||||
test_convert_neg_rat<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_rat<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_float(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -137,12 +137,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_CLOSE_FRACTION(t4, answer, tol);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_float(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_floating_point> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_floating_point> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -153,7 +153,7 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To tol = (std::max)(std::numeric_limits<To>::epsilon(), To(std::numeric_limits<From>::epsilon())) * 2;
|
||||
BOOST_CHECK_CLOSE_FRACTION(t1, answer, tol);
|
||||
BOOST_CHECK_CLOSE_FRACTION(t2, answer, tol);
|
||||
test_convert_neg_float<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_float<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ T generate_random()
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_int(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -66,12 +66,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t4));
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_int(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_integer> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_integer> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -80,12 +80,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t1));
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t2));
|
||||
test_convert_neg_int<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_int<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_rat(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -95,12 +95,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_CLOSE_FRACTION(From(t4), from, tol);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_rat_int(From const&, const boost::mpl::false_&)
|
||||
void test_convert_rat_int(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_rational> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_rational> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -110,12 +110,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
From tol = std::numeric_limits<From>::epsilon();
|
||||
BOOST_CHECK_CLOSE_FRACTION(From(t1), from, tol);
|
||||
BOOST_CHECK_CLOSE_FRACTION(From(t2), from, tol);
|
||||
test_convert_neg_rat<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_rat<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_float(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -126,12 +126,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_CLOSE_FRACTION(t4, answer, tol);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_float(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_floating_point> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_floating_point> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -142,7 +142,7 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To tol = (std::max)(std::numeric_limits<To>::epsilon(), To(std::numeric_limits<From>::epsilon())) * 2;
|
||||
BOOST_CHECK_CLOSE_FRACTION(t1, answer, tol);
|
||||
BOOST_CHECK_CLOSE_FRACTION(t2, answer, tol);
|
||||
test_convert_neg_float<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_float<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ T generate_random(unsigned bits_wanted)
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_int(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -80,12 +80,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(from.str(), t4.str());
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_int(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::int_<number_kind_integer> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_integer> const&, std::integral_constant<int, number_kind_integer> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -96,12 +96,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(from.str(), t1.str());
|
||||
BOOST_CHECK_EQUAL(from.str(), t2.str());
|
||||
test_convert_neg_int<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_int<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_rat(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -110,12 +110,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(from.str(), numerator(t4).str());
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_rat(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::int_<number_kind_rational> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_integer> const&, std::integral_constant<int, number_kind_rational> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -126,12 +126,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(from.str(), numerator(t1).str());
|
||||
BOOST_CHECK_EQUAL(from.str(), numerator(t2).str());
|
||||
test_convert_neg_rat<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_rat<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_float(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -141,12 +141,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(t4, check);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_float(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::int_<number_kind_floating_point> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_integer> const&, std::integral_constant<int, number_kind_floating_point> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -158,7 +158,7 @@ void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::
|
||||
To check(from.str() + ".0");
|
||||
BOOST_CHECK_EQUAL(t1, check);
|
||||
BOOST_CHECK_EQUAL(t2, check);
|
||||
test_convert_neg_float<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_float<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ T generate_random(unsigned bits_wanted)
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_val(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_val(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
typename component_type<From>::type answer = numerator(from) / denominator(from);
|
||||
@@ -89,12 +89,12 @@ void test_convert_neg_val(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(answer.str(), t4.str());
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_val(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_val(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl::int_<number_kind_integer> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_rational> const&, std::integral_constant<int, number_kind_integer> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -106,12 +106,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl:
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(answer.str(), t1.str());
|
||||
BOOST_CHECK_EQUAL(answer.str(), t2.str());
|
||||
test_convert_neg_val<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_val<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float_val(From from, To const& tol, const boost::mpl::true_&)
|
||||
void test_convert_neg_float_val(From from, To const& tol, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To answer = To(numerator(from)) / To(denominator(from));
|
||||
@@ -121,12 +121,12 @@ void test_convert_neg_float_val(From from, To const& tol, const boost::mpl::true
|
||||
BOOST_CHECK_CLOSE_FRACTION(answer, t4, tol);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float_val(From const&, To const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_float_val(From const&, To const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl::int_<number_kind_floating_point> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_rational> const&, std::integral_constant<int, number_kind_floating_point> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -140,12 +140,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl:
|
||||
tol *= 2;
|
||||
BOOST_CHECK_CLOSE_FRACTION(answer, t1, tol);
|
||||
BOOST_CHECK_CLOSE_FRACTION(answer, t2, tol);
|
||||
test_convert_neg_float_val<From, To>(from, tol, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_float_val<From, To>(from, tol, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat_val(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_rat_val(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -154,12 +154,12 @@ void test_convert_neg_rat_val(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(from.str(), t4.str());
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat_val(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_rat_val(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl::int_<number_kind_rational> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_rational> const&, std::integral_constant<int, number_kind_rational> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -170,7 +170,7 @@ void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl:
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(from.str(), t1.str());
|
||||
BOOST_CHECK_EQUAL(from.str(), t2.str());
|
||||
test_convert_neg_rat_val<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_rat_val<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ T generate_random()
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_int(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -68,12 +68,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t4));
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_int(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_integer> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_integer> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -82,12 +82,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t1));
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t2));
|
||||
test_convert_neg_int<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_int<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_rat(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -96,12 +96,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(From(t4), from);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_rat_int(From const&, const boost::mpl::false_&)
|
||||
void test_convert_rat_int(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_rational> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_rational> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -110,12 +110,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(From(t1), from);
|
||||
BOOST_CHECK_EQUAL(From(t2), from);
|
||||
test_convert_neg_rat<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_rat<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_float(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -126,12 +126,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_CLOSE_FRACTION(t4, answer, tol);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_float(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_floating_point> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_floating_point> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -142,7 +142,7 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To tol = (std::max)(std::numeric_limits<To>::epsilon(), To(std::numeric_limits<From>::epsilon())) * 2;
|
||||
BOOST_CHECK_CLOSE_FRACTION(t1, answer, tol);
|
||||
BOOST_CHECK_CLOSE_FRACTION(t2, answer, tol);
|
||||
test_convert_neg_float<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_float<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ T generate_random(unsigned bits_wanted)
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_val(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_val(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
typename component_type<From>::type answer = numerator(from) / denominator(from);
|
||||
@@ -89,12 +89,12 @@ void test_convert_neg_val(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(answer.str(), t4.str());
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_val(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_val(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl::int_<number_kind_integer> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_rational> const&, std::integral_constant<int, number_kind_integer> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -106,12 +106,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl:
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(answer.str(), t1.str());
|
||||
BOOST_CHECK_EQUAL(answer.str(), t2.str());
|
||||
test_convert_neg_val<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_val<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float_val(From from, To const& tol, const boost::mpl::true_&)
|
||||
void test_convert_neg_float_val(From from, To const& tol, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To answer = To(numerator(from)) / To(denominator(from));
|
||||
@@ -121,12 +121,12 @@ void test_convert_neg_float_val(From from, To const& tol, const boost::mpl::true
|
||||
BOOST_CHECK_CLOSE_FRACTION(answer, t4, tol);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float_val(From const&, To const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_float_val(From const&, To const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl::int_<number_kind_floating_point> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_rational> const&, std::integral_constant<int, number_kind_floating_point> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -140,12 +140,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl:
|
||||
tol *= 2;
|
||||
BOOST_CHECK_CLOSE_FRACTION(answer, t1, tol);
|
||||
BOOST_CHECK_CLOSE_FRACTION(answer, t2, tol);
|
||||
test_convert_neg_float_val<From, To>(from, tol, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_float_val<From, To>(from, tol, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat_val(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_rat_val(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -154,12 +154,12 @@ void test_convert_neg_rat_val(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(from.str(), t4.str());
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat_val(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_rat_val(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl::int_<number_kind_rational> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_rational> const&, std::integral_constant<int, number_kind_rational> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -170,7 +170,7 @@ void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl:
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(from.str(), t1.str());
|
||||
BOOST_CHECK_EQUAL(from.str(), t2.str());
|
||||
test_convert_neg_rat_val<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_rat_val<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ T generate_random()
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_int(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -68,12 +68,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t4));
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_int(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_integer> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_integer> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -82,12 +82,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t1));
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t2));
|
||||
test_convert_neg_int<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_int<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_rat(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -97,12 +97,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_CLOSE_FRACTION(From(t4), from, tol);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_rat_int(From const&, const boost::mpl::false_&)
|
||||
void test_convert_rat_int(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_rational> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_rational> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -112,12 +112,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
From tol = std::numeric_limits<From>::epsilon();
|
||||
BOOST_CHECK_CLOSE_FRACTION(From(t1), from, tol);
|
||||
BOOST_CHECK_CLOSE_FRACTION(From(t2), from, tol);
|
||||
test_convert_neg_rat<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_rat<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_float(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -128,12 +128,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_CLOSE_FRACTION(t4, answer, tol);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_float(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_floating_point> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_floating_point> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -144,7 +144,7 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To tol = (std::max)(std::numeric_limits<To>::epsilon(), To(std::numeric_limits<From>::epsilon())) * 2;
|
||||
BOOST_CHECK_CLOSE_FRACTION(t1, answer, tol);
|
||||
BOOST_CHECK_CLOSE_FRACTION(t2, answer, tol);
|
||||
test_convert_neg_float<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_float<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ T generate_random()
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_int(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -70,12 +70,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t4));
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_int(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_integer> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_integer> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -84,12 +84,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t1));
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t2));
|
||||
test_convert_neg_int<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_int<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_rat(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -98,12 +98,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(From(t4), median(from));
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_rat_int(From const&, const boost::mpl::false_&)
|
||||
void test_convert_rat_int(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_rational> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_rational> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -112,12 +112,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(From(t1), median(from));
|
||||
BOOST_CHECK_EQUAL(From(t2), median(from));
|
||||
test_convert_neg_rat<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_rat<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_float(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -128,12 +128,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_CLOSE_FRACTION(t4, answer, tol);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_float(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_floating_point> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_floating_point> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -144,7 +144,7 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To tol = (std::max)(std::numeric_limits<To>::epsilon(), To(std::numeric_limits<From>::epsilon())) * 2;
|
||||
BOOST_CHECK_CLOSE_FRACTION(t1, answer, tol);
|
||||
BOOST_CHECK_CLOSE_FRACTION(t2, answer, tol);
|
||||
test_convert_neg_float<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_float<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ T generate_random()
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_int(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -68,12 +68,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t4));
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_int(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_integer> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_integer> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -82,12 +82,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t1));
|
||||
BOOST_CHECK_EQUAL(From(trunc(from)), From(t2));
|
||||
test_convert_neg_int<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_int<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_rat(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -96,12 +96,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(From(t4), from);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_rat_int(From const&, const boost::mpl::false_&)
|
||||
void test_convert_rat_int(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_rational> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_rational> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -110,12 +110,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(From(t1), from);
|
||||
BOOST_CHECK_EQUAL(From(t2), from);
|
||||
test_convert_neg_rat<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_rat<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_float(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -126,12 +126,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_CLOSE_FRACTION(t4, answer, tol);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_float(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost::mpl::int_<number_kind_floating_point> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_floating_point> const&, std::integral_constant<int, number_kind_floating_point> const&)
|
||||
{
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
{
|
||||
@@ -142,7 +142,7 @@ void test_convert_imp(boost::mpl::int_<number_kind_floating_point> const&, boost
|
||||
To tol = (std::max)(std::numeric_limits<To>::epsilon(), To(std::numeric_limits<From>::epsilon())) * 2;
|
||||
BOOST_CHECK_CLOSE_FRACTION(t1, answer, tol);
|
||||
BOOST_CHECK_CLOSE_FRACTION(t2, answer, tol);
|
||||
test_convert_neg_float<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_float<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ T generate_random(unsigned bits_wanted)
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_int(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -80,12 +80,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(from.str(), t4.str());
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_int(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::int_<number_kind_integer> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_integer> const&, std::integral_constant<int, number_kind_integer> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -96,12 +96,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(from.str(), t1.str());
|
||||
BOOST_CHECK_EQUAL(from.str(), t2.str());
|
||||
test_convert_neg_int<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_int<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_rat(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -110,12 +110,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(from.str(), numerator(t4).str());
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_rat(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::int_<number_kind_rational> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_integer> const&, std::integral_constant<int, number_kind_rational> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -126,12 +126,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(from.str(), numerator(t1).str());
|
||||
BOOST_CHECK_EQUAL(from.str(), numerator(t2).str());
|
||||
test_convert_neg_rat<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_rat<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_float(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -141,12 +141,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(t4, check);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_float(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::int_<number_kind_floating_point> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_integer> const&, std::integral_constant<int, number_kind_floating_point> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -158,7 +158,7 @@ void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::
|
||||
To check(from.str() + ".0");
|
||||
BOOST_CHECK_EQUAL(t1, check);
|
||||
BOOST_CHECK_EQUAL(t2, check);
|
||||
test_convert_neg_float<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_float<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ T generate_random(unsigned bits_wanted)
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_int(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -80,12 +80,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(from.str(), t4.str());
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_int(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_int(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::int_<number_kind_integer> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_integer> const&, std::integral_constant<int, number_kind_integer> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -96,12 +96,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(from.str(), t1.str());
|
||||
BOOST_CHECK_EQUAL(from.str(), t2.str());
|
||||
test_convert_neg_int<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_int<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_rat(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -110,12 +110,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(from.str(), numerator(t4).str());
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_rat(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::int_<number_kind_rational> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_integer> const&, std::integral_constant<int, number_kind_rational> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -126,12 +126,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(from.str(), numerator(t1).str());
|
||||
BOOST_CHECK_EQUAL(from.str(), numerator(t2).str());
|
||||
test_convert_neg_rat<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_rat<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_float(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -141,12 +141,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(t4, check);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_float(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::int_<number_kind_floating_point> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_integer> const&, std::integral_constant<int, number_kind_floating_point> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -158,7 +158,7 @@ void test_convert_imp(boost::mpl::int_<number_kind_integer> const&, boost::mpl::
|
||||
To check(from.str() + ".0");
|
||||
BOOST_CHECK_EQUAL(t1, check);
|
||||
BOOST_CHECK_EQUAL(t2, check);
|
||||
test_convert_neg_float<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_float<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ T generate_random(unsigned bits_wanted)
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_val(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_val(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
typename component_type<From>::type answer = numerator(from) / denominator(from);
|
||||
@@ -89,12 +89,12 @@ void test_convert_neg_val(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(answer.str(), t4.str());
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_val(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_val(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl::int_<number_kind_integer> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_rational> const&, std::integral_constant<int, number_kind_integer> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -106,12 +106,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl:
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(answer.str(), t1.str());
|
||||
BOOST_CHECK_EQUAL(answer.str(), t2.str());
|
||||
test_convert_neg_val<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_val<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float_val(From from, To const& tol, const boost::mpl::true_&)
|
||||
void test_convert_neg_float_val(From from, To const& tol, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To answer = To(numerator(from)) / To(denominator(from));
|
||||
@@ -121,12 +121,12 @@ void test_convert_neg_float_val(From from, To const& tol, const boost::mpl::true
|
||||
BOOST_CHECK_CLOSE_FRACTION(answer, t4, tol);
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_float_val(From const&, To const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_float_val(From const&, To const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl::int_<number_kind_floating_point> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_rational> const&, std::integral_constant<int, number_kind_floating_point> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -140,12 +140,12 @@ void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl:
|
||||
tol *= 2;
|
||||
BOOST_CHECK_CLOSE_FRACTION(answer, t1, tol);
|
||||
BOOST_CHECK_CLOSE_FRACTION(answer, t2, tol);
|
||||
test_convert_neg_float_val<From, To>(from, tol, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_float_val<From, To>(from, tol, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat_val(From from, const boost::mpl::true_&)
|
||||
void test_convert_neg_rat_val(From from, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
from = -from;
|
||||
To t3(from);
|
||||
@@ -154,12 +154,12 @@ void test_convert_neg_rat_val(From from, const boost::mpl::true_&)
|
||||
BOOST_CHECK_EQUAL(from.str(), t4.str());
|
||||
}
|
||||
template <class From, class To>
|
||||
void test_convert_neg_rat_val(From const&, const boost::mpl::false_&)
|
||||
void test_convert_neg_rat_val(From const&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl::int_<number_kind_rational> const&)
|
||||
void test_convert_imp(std::integral_constant<int, number_kind_rational> const&, std::integral_constant<int, number_kind_rational> const&)
|
||||
{
|
||||
int bits_wanted = (std::min)((std::min)(std::numeric_limits<From>::digits, std::numeric_limits<To>::digits), 2000);
|
||||
|
||||
@@ -170,7 +170,7 @@ void test_convert_imp(boost::mpl::int_<number_kind_rational> const&, boost::mpl:
|
||||
To t2 = from.template convert_to<To>();
|
||||
BOOST_CHECK_EQUAL(from.str(), t1.str());
|
||||
BOOST_CHECK_EQUAL(from.str(), t2.str());
|
||||
test_convert_neg_rat_val<From, To>(from, boost::mpl::bool_ < std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
test_convert_neg_rat_val<From, To>(from, std::integral_constant<bool, std::numeric_limits<From>::is_signed && std::numeric_limits<To>::is_signed > ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,10 +73,10 @@ T generate_random(unsigned bits_wanted)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct is_checked_cpp_int : public boost::mpl::false_
|
||||
struct is_checked_cpp_int : public std::integral_constant<bool, false>
|
||||
{};
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ET>
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public boost::mpl::true_
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template <class Number>
|
||||
|
||||
@@ -53,7 +53,7 @@ T generate_random()
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_round_trip_neg(T val, const boost::mpl::true_&)
|
||||
void test_round_trip_neg(T val, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
// Try some negative values:
|
||||
std::vector<unsigned char> cv;
|
||||
@@ -65,7 +65,7 @@ void test_round_trip_neg(T val, const boost::mpl::true_&)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_round_trip_neg(const T&, const boost::mpl::false_&)
|
||||
void test_round_trip_neg(const T&, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ void test_round_trip(T val)
|
||||
import_bits(newval, cv.begin(), cv.end(), 6, false);
|
||||
BOOST_CHECK_EQUAL(val, newval);
|
||||
|
||||
test_round_trip_neg(val, boost::mpl::bool_<std::numeric_limits<T>::is_signed>());
|
||||
test_round_trip_neg(val, std::integral_constant<bool, std::numeric_limits<T>::is_signed>());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
||||
@@ -68,10 +68,10 @@ T generate_random(unsigned bits_wanted)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct is_checked_cpp_int : public boost::mpl::false_
|
||||
struct is_checked_cpp_int : public std::integral_constant<bool, false>
|
||||
{};
|
||||
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ET>
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public boost::mpl::true_
|
||||
struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public std::integral_constant<bool, true>
|
||||
{};
|
||||
|
||||
template <class N>
|
||||
|
||||
@@ -72,12 +72,12 @@ void test_value(const T& val)
|
||||
}
|
||||
}
|
||||
|
||||
void test(const boost::mpl::int_<200>&) {}
|
||||
void test(const std::integral_constant<int, 200>&) {}
|
||||
|
||||
template <int N>
|
||||
void test(boost::mpl::int_<N> const&)
|
||||
void test(std::integral_constant<int, N> const&)
|
||||
{
|
||||
test(boost::mpl::int_<N + 4>());
|
||||
test(std::integral_constant<int, N + 4>());
|
||||
|
||||
typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<N, N, boost::multiprecision::unsigned_magnitude>, boost::multiprecision::et_off> mp_type;
|
||||
|
||||
@@ -92,6 +92,6 @@ void test(boost::mpl::int_<N> const&)
|
||||
|
||||
int main()
|
||||
{
|
||||
test(boost::mpl::int_<24>());
|
||||
test(std::integral_constant<int, 24>());
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ T generate_random(unsigned bits_wanted)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_neg(const T& x, const boost::mpl::true_&)
|
||||
void test_neg(const T& x, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
T val = -x;
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
@@ -100,7 +100,7 @@ void test_neg(const T& x, const boost::mpl::true_&)
|
||||
#endif
|
||||
}
|
||||
template <class T>
|
||||
void test_neg(const T&, const boost::mpl::false_&) {}
|
||||
void test_neg(const T&, const std::integral_constant<bool, false>&) {}
|
||||
|
||||
template <class T>
|
||||
void test()
|
||||
@@ -159,7 +159,7 @@ void test()
|
||||
std::cout << e.what() << std::endl;
|
||||
}
|
||||
#endif
|
||||
test_neg(val, boost::mpl::bool_<std::numeric_limits<T>::is_signed>());
|
||||
test_neg(val, std::integral_constant<bool, std::numeric_limits<T>::is_signed>());
|
||||
//
|
||||
// Check to see if test is taking too long.
|
||||
// Tests run on the compiler farm time out after 300 seconds,
|
||||
|
||||
@@ -66,7 +66,7 @@ T generate_random(unsigned bits_wanted)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_neg(const T& x, const boost::mpl::true_&)
|
||||
void test_neg(const T& x, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
T val = -x;
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
@@ -115,7 +115,7 @@ void test_neg(const T& x, const boost::mpl::true_&)
|
||||
#endif
|
||||
}
|
||||
template <class T>
|
||||
void test_neg(const T&, const boost::mpl::false_&) {}
|
||||
void test_neg(const T&, const std::integral_constant<bool, false>&) {}
|
||||
|
||||
template <class T>
|
||||
void test()
|
||||
@@ -160,7 +160,7 @@ void test()
|
||||
std::cout << e.what() << std::endl;
|
||||
}
|
||||
#endif
|
||||
test_neg(val, boost::mpl::bool_<std::numeric_limits<T>::is_signed>());
|
||||
test_neg(val, std::integral_constant<bool, std::numeric_limits<T>::is_signed>());
|
||||
|
||||
//
|
||||
// Check to see if test is taking too long.
|
||||
|
||||
@@ -52,18 +52,18 @@ struct NumTraits<boost::multiprecision::number<Backend, ExpressionTemplates> >
|
||||
{
|
||||
return (std::numeric_limits<Real>::min)();
|
||||
}
|
||||
static int digits10_imp(const boost::mpl::true_&)
|
||||
static int digits10_imp(const std::integral_constant<bool, true>&)
|
||||
{
|
||||
return std::numeric_limits<Real>::digits10;
|
||||
}
|
||||
template <bool B>
|
||||
static int digits10_imp(const boost::mpl::bool_<B>&)
|
||||
static int digits10_imp(const std::integral_constant<bool, B>&)
|
||||
{
|
||||
return Real::default_precision();
|
||||
}
|
||||
static int digits10()
|
||||
{
|
||||
return digits10_imp(boost::mpl::bool_ < std::numeric_limits<Real>::digits10 && (std::numeric_limits<Real>::digits10 != INT_MAX) ? true : false > ());
|
||||
return digits10_imp(std::integral_constant<bool, std::numeric_limits<Real>::digits10 && (std::numeric_limits<Real>::digits10 != INT_MAX) ? true : false > ());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -104,17 +104,17 @@ void do_round_trip(const T& val)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void negative_round_trip(T val, const boost::mpl::true_&)
|
||||
void negative_round_trip(T val, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
do_round_trip(T(-val));
|
||||
}
|
||||
template <class T>
|
||||
void negative_round_trip(T, const boost::mpl::false_&)
|
||||
void negative_round_trip(T, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void negative_spots(const boost::mpl::true_&)
|
||||
void negative_spots(const std::integral_constant<bool, true>&)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(T(-1002).str(), "-1002");
|
||||
if (!std::numeric_limits<T>::is_modulo)
|
||||
@@ -126,7 +126,7 @@ void negative_spots(const boost::mpl::true_&)
|
||||
}
|
||||
}
|
||||
template <class T>
|
||||
void negative_spots(const boost::mpl::false_&)
|
||||
void negative_spots(const std::integral_constant<bool, false>&)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ void test_round_trip()
|
||||
{
|
||||
T val = generate_random<T>();
|
||||
do_round_trip(val);
|
||||
negative_round_trip(val, boost::mpl::bool_<std::numeric_limits<T>::is_signed>());
|
||||
negative_round_trip(val, std::integral_constant<bool, std::numeric_limits<T>::is_signed>());
|
||||
}
|
||||
|
||||
BOOST_CHECK_EQUAL(T(1002).str(), "1002");
|
||||
@@ -151,7 +151,7 @@ void test_round_trip()
|
||||
BOOST_CHECK_EQUAL(T(1002).str(0, std::ios_base::dec), "1002");
|
||||
BOOST_CHECK_EQUAL(T(1002).str(0, std::ios_base::dec | std::ios_base::showbase), "1002");
|
||||
|
||||
negative_spots<T>(boost::mpl::bool_<std::numeric_limits<T>::is_signed>());
|
||||
negative_spots<T>(std::integral_constant<bool, std::numeric_limits<T>::is_signed>());
|
||||
}
|
||||
|
||||
int main()
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@
|
||||
#include "test.hpp"
|
||||
|
||||
template <class Big, class Small>
|
||||
void test_floats(const boost::mpl::true_)
|
||||
void test_floats(const std::integral_constant<bool, true>)
|
||||
{
|
||||
Big big_val = boost::math::constants::pi<Big>();
|
||||
Small small = boost::math::constants::pi<Small>();
|
||||
@@ -47,7 +47,7 @@ void test_floats(const boost::mpl::true_)
|
||||
}
|
||||
|
||||
template <class Big, class Small>
|
||||
void test_floats(const boost::mpl::false_){}
|
||||
void test_floats(const std::integral_constant<bool, false>){}
|
||||
|
||||
template <class Big, class Small>
|
||||
void test()
|
||||
@@ -227,7 +227,7 @@ void test()
|
||||
BOOST_CHECK_EQUAL((big_val * 1) * (small_val * 1), (big_val * 1) * Big((small_val * 1)));
|
||||
BOOST_CHECK_EQUAL((big_val * 1) / (small_val * 1), (big_val * 1) / Big((small_val * 1)));
|
||||
|
||||
test_floats<Big, Small>(boost::mpl::bool_<boost::multiprecision::number_category<Big>::value == boost::multiprecision::number_kind_floating_point>());
|
||||
test_floats<Big, Small>(std::integral_constant<bool, boost::multiprecision::number_category<Big>::value == boost::multiprecision::number_kind_floating_point>());
|
||||
}
|
||||
|
||||
#endif // BOOST_MATH_TEST_MIXED_HPP
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user