mirror of
https://github.com/boostorg/multiprecision.git
synced 2026-02-19 02:22:17 +00:00
Replace long long with boost::long_long_type to avoid GCC warnings/errors in pedantic mode.
Fix missing return statements on new long long code.
This commit is contained in:
@@ -26,8 +26,8 @@ namespace concepts{
|
||||
|
||||
struct number_backend_float_architype
|
||||
{
|
||||
typedef mpl::list<long long> signed_types;
|
||||
typedef mpl::list<unsigned long long> unsigned_types;
|
||||
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 int exponent_type;
|
||||
|
||||
@@ -46,13 +46,13 @@ struct number_backend_float_architype
|
||||
std::cout << "Assignment (" << m_value << ")" << std::endl;
|
||||
return *this;
|
||||
}
|
||||
number_backend_float_architype& operator = (unsigned long long i)
|
||||
number_backend_float_architype& operator = (boost::ulong_long_type i)
|
||||
{
|
||||
m_value = i;
|
||||
std::cout << "UInt Assignment (" << i << ")" << std::endl;
|
||||
return *this;
|
||||
}
|
||||
number_backend_float_architype& operator = (long long i)
|
||||
number_backend_float_architype& operator = (boost::long_long_type i)
|
||||
{
|
||||
m_value = i;
|
||||
std::cout << "Int Assignment (" << i << ")" << std::endl;
|
||||
@@ -112,12 +112,12 @@ struct number_backend_float_architype
|
||||
std::cout << "Comparison" << std::endl;
|
||||
return m_value > o.m_value ? 1 : (m_value < o.m_value ? -1 : 0);
|
||||
}
|
||||
int compare(long long i)const
|
||||
int compare(boost::long_long_type i)const
|
||||
{
|
||||
std::cout << "Comparison with int" << std::endl;
|
||||
return m_value > i ? 1 : (m_value < i ? -1 : 0);
|
||||
}
|
||||
int compare(unsigned long long i)const
|
||||
int compare(boost::ulong_long_type i)const
|
||||
{
|
||||
std::cout << "Comparison with unsigned" << std::endl;
|
||||
return m_value > i ? 1 : (m_value < i ? -1 : 0);
|
||||
@@ -151,13 +151,13 @@ inline void eval_divide(number_backend_float_architype& result, const number_bac
|
||||
result.m_value /= o.m_value;
|
||||
}
|
||||
|
||||
inline void eval_convert_to(unsigned long long* result, const number_backend_float_architype& val)
|
||||
inline void eval_convert_to(boost::ulong_long_type* result, const number_backend_float_architype& val)
|
||||
{
|
||||
*result = static_cast<unsigned long long>(val.m_value);
|
||||
*result = static_cast<boost::ulong_long_type>(val.m_value);
|
||||
}
|
||||
inline void eval_convert_to(long long* result, const number_backend_float_architype& val)
|
||||
inline void eval_convert_to(boost::long_long_type* result, const number_backend_float_architype& val)
|
||||
{
|
||||
*result = static_cast<long long>(val.m_value);
|
||||
*result = static_cast<boost::long_long_type>(val.m_value);
|
||||
}
|
||||
inline void eval_convert_to(long double* result, number_backend_float_architype& val)
|
||||
{
|
||||
|
||||
@@ -1045,7 +1045,7 @@ inline bool eval_eq(const cpp_bin_float<Digits, DigitBase, Allocator, Exponent,
|
||||
}
|
||||
|
||||
template <unsigned Digits, digit_base_type DigitBase, class Allocator, class Exponent, Exponent MinE, Exponent MaxE>
|
||||
inline void eval_convert_to(long long *res, const cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> &arg)
|
||||
inline void eval_convert_to(boost::long_long_type *res, const cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> &arg)
|
||||
{
|
||||
switch(arg.exponent())
|
||||
{
|
||||
@@ -1055,7 +1055,7 @@ inline void eval_convert_to(long long *res, const cpp_bin_float<Digits, DigitBas
|
||||
case cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_nan:
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Could not convert NaN to integer."));
|
||||
case cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_infinity:
|
||||
*res = (std::numeric_limits<long long>::max)();
|
||||
*res = (std::numeric_limits<boost::long_long_type>::max)();
|
||||
if(arg.sign())
|
||||
*res = -*res;
|
||||
return;
|
||||
@@ -1068,14 +1068,14 @@ inline void eval_convert_to(long long *res, const cpp_bin_float<Digits, DigitBas
|
||||
*res = 0;
|
||||
return;
|
||||
}
|
||||
if(arg.sign() && (arg.compare((std::numeric_limits<long long>::min)()) <= 0))
|
||||
if(arg.sign() && (arg.compare((std::numeric_limits<boost::long_long_type>::min)()) <= 0))
|
||||
{
|
||||
*res = (std::numeric_limits<long long>::min)();
|
||||
*res = (std::numeric_limits<boost::long_long_type>::min)();
|
||||
return;
|
||||
}
|
||||
else if(!arg.sign() && (arg.compare((std::numeric_limits<long long>::max)()) >= 0))
|
||||
else if(!arg.sign() && (arg.compare((std::numeric_limits<boost::long_long_type>::max)()) >= 0))
|
||||
{
|
||||
*res = (std::numeric_limits<long long>::max)();
|
||||
*res = (std::numeric_limits<boost::long_long_type>::max)();
|
||||
return;
|
||||
}
|
||||
eval_right_shift(man, shift);
|
||||
@@ -1087,7 +1087,7 @@ inline void eval_convert_to(long long *res, const cpp_bin_float<Digits, DigitBas
|
||||
}
|
||||
|
||||
template <unsigned Digits, digit_base_type DigitBase, class Allocator, class Exponent, Exponent MinE, Exponent MaxE>
|
||||
inline void eval_convert_to(unsigned long long *res, const cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> &arg)
|
||||
inline void eval_convert_to(boost::ulong_long_type *res, const cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> &arg)
|
||||
{
|
||||
switch(arg.exponent())
|
||||
{
|
||||
@@ -1097,7 +1097,7 @@ inline void eval_convert_to(unsigned long long *res, const cpp_bin_float<Digits,
|
||||
case cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_nan:
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Could not convert NaN to integer."));
|
||||
case cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_infinity:
|
||||
*res = (std::numeric_limits<unsigned long long>::max)();
|
||||
*res = (std::numeric_limits<boost::ulong_long_type>::max)();
|
||||
return;
|
||||
}
|
||||
typename cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::rep_type man(arg.bits());
|
||||
@@ -1110,8 +1110,8 @@ inline void eval_convert_to(unsigned long long *res, const cpp_bin_float<Digits,
|
||||
}
|
||||
else if(shift < 0)
|
||||
{
|
||||
// TODO: what if we have fewer cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count than a long long?
|
||||
*res = (std::numeric_limits<long long>::max)();
|
||||
// TODO: what if we have fewer cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count than a boost::long_long_type?
|
||||
*res = (std::numeric_limits<boost::long_long_type>::max)();
|
||||
return;
|
||||
}
|
||||
eval_right_shift(man, shift);
|
||||
|
||||
@@ -59,8 +59,8 @@ private:
|
||||
BOOST_STATIC_ASSERT_MSG(sizeof(ExponentType) > 1, "ExponentType is too small.");
|
||||
|
||||
public:
|
||||
typedef mpl::list<long long> signed_types;
|
||||
typedef mpl::list<unsigned long long> unsigned_types;
|
||||
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 ExponentType exponent_type;
|
||||
|
||||
@@ -284,21 +284,21 @@ public:
|
||||
static const cpp_dec_float& zero()
|
||||
{
|
||||
init.do_nothing();
|
||||
static cpp_dec_float val(static_cast<unsigned long long>(0u));
|
||||
static cpp_dec_float val(static_cast<boost::ulong_long_type>(0u));
|
||||
return val;
|
||||
}
|
||||
|
||||
static const cpp_dec_float& one()
|
||||
{
|
||||
init.do_nothing();
|
||||
static cpp_dec_float val(static_cast<unsigned long long>(1u));
|
||||
static cpp_dec_float val(static_cast<boost::ulong_long_type>(1u));
|
||||
return val;
|
||||
}
|
||||
|
||||
static const cpp_dec_float& two()
|
||||
{
|
||||
init.do_nothing();
|
||||
static cpp_dec_float val(static_cast<unsigned long long>(2u));
|
||||
static cpp_dec_float val(static_cast<boost::ulong_long_type>(2u));
|
||||
return val;
|
||||
}
|
||||
|
||||
@@ -348,21 +348,21 @@ public:
|
||||
static const cpp_dec_float& long_long_max()
|
||||
{
|
||||
init.do_nothing();
|
||||
static cpp_dec_float val((std::numeric_limits<long long>::max)());
|
||||
static cpp_dec_float val((std::numeric_limits<boost::long_long_type>::max)());
|
||||
return val;
|
||||
}
|
||||
|
||||
static const cpp_dec_float& long_long_min()
|
||||
{
|
||||
init.do_nothing();
|
||||
static cpp_dec_float val((std::numeric_limits<long long>::min)());
|
||||
static cpp_dec_float val((std::numeric_limits<boost::long_long_type>::min)());
|
||||
return val;
|
||||
}
|
||||
|
||||
static const cpp_dec_float& ulong_long_max()
|
||||
{
|
||||
init.do_nothing();
|
||||
static cpp_dec_float val((std::numeric_limits<unsigned long long>::max)());
|
||||
static cpp_dec_float val((std::numeric_limits<boost::ulong_long_type>::max)());
|
||||
return val;
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
cpp_dec_float& operator=(long long v)
|
||||
cpp_dec_float& operator=(boost::long_long_type v)
|
||||
{
|
||||
if(v < 0)
|
||||
{
|
||||
@@ -409,7 +409,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
cpp_dec_float& operator=(unsigned long long v)
|
||||
cpp_dec_float& operator=(boost::ulong_long_type v)
|
||||
{
|
||||
from_unsigned_long_long(v);
|
||||
return *this;
|
||||
@@ -428,22 +428,22 @@ public:
|
||||
cpp_dec_float& operator*=(const cpp_dec_float& v);
|
||||
cpp_dec_float& operator/=(const cpp_dec_float& v);
|
||||
|
||||
cpp_dec_float& add_unsigned_long_long(const unsigned long long n)
|
||||
cpp_dec_float& add_unsigned_long_long(const boost::ulong_long_type n)
|
||||
{
|
||||
cpp_dec_float t;
|
||||
t.from_unsigned_long_long(n);
|
||||
return *this += t;
|
||||
}
|
||||
|
||||
cpp_dec_float& sub_unsigned_long_long(const unsigned long long n)
|
||||
cpp_dec_float& sub_unsigned_long_long(const boost::ulong_long_type n)
|
||||
{
|
||||
cpp_dec_float t;
|
||||
t.from_unsigned_long_long(n);
|
||||
return *this -= t;
|
||||
}
|
||||
|
||||
cpp_dec_float& mul_unsigned_long_long(const unsigned long long n);
|
||||
cpp_dec_float& div_unsigned_long_long(const unsigned long long n);
|
||||
cpp_dec_float& mul_unsigned_long_long(const boost::ulong_long_type n);
|
||||
cpp_dec_float& div_unsigned_long_long(const boost::ulong_long_type n);
|
||||
|
||||
// Elementary primitives.
|
||||
cpp_dec_float& calculate_inv ();
|
||||
@@ -503,8 +503,8 @@ public:
|
||||
|
||||
double extract_double() const;
|
||||
long double extract_long_double() const;
|
||||
signed long long extract_signed_long_long() const;
|
||||
unsigned long long extract_unsigned_long_long() const;
|
||||
boost::long_long_type extract_signed_long_long() const;
|
||||
boost::ulong_long_type extract_unsigned_long_long() const;
|
||||
void extract_parts(double& mantissa, ExponentType& exponent) const;
|
||||
cpp_dec_float extract_integer_part() const;
|
||||
|
||||
@@ -522,7 +522,7 @@ public:
|
||||
prec_elem = (std::min)(cpp_dec_float_elem_number, (std::max)(elems, static_cast<boost::int32_t>(2)));
|
||||
}
|
||||
}
|
||||
static cpp_dec_float pow2(long long i);
|
||||
static cpp_dec_float pow2(boost::long_long_type i);
|
||||
ExponentType order()const
|
||||
{
|
||||
const bool bo_order_is_zero = ((!(isfinite)()) || (data[0] == static_cast<boost::uint32_t>(0u)));
|
||||
@@ -590,7 +590,7 @@ private:
|
||||
static bool data_elem_is_non_nine_predicate(const boost::uint32_t& d) { return (d != static_cast<boost::uint32_t>(cpp_dec_float::cpp_dec_float_elem_mask - 1)); }
|
||||
static bool char_is_nonzero_predicate(const char& c) { return (c != static_cast<char>('0')); }
|
||||
|
||||
void from_unsigned_long_long(const unsigned long long u);
|
||||
void from_unsigned_long_long(const boost::ulong_long_type u);
|
||||
|
||||
int cmp_data(const array_type& vd) const;
|
||||
|
||||
@@ -970,9 +970,9 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
|
||||
}
|
||||
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, ExponentType, Allocator>::mul_unsigned_long_long(const unsigned long long n)
|
||||
cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, ExponentType, Allocator>::mul_unsigned_long_long(const boost::ulong_long_type n)
|
||||
{
|
||||
// Multiply *this with a constant unsigned long long.
|
||||
// Multiply *this with a constant boost::ulong_long_type.
|
||||
|
||||
// Evaluate the sign of the result.
|
||||
const bool b_neg = neg;
|
||||
@@ -1003,7 +1003,7 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
|
||||
return *this = zero();
|
||||
}
|
||||
|
||||
if(n >= static_cast<unsigned long long>(cpp_dec_float_elem_mask))
|
||||
if(n >= static_cast<boost::ulong_long_type>(cpp_dec_float_elem_mask))
|
||||
{
|
||||
neg = b_neg;
|
||||
cpp_dec_float t;
|
||||
@@ -1011,7 +1011,7 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
|
||||
return operator*=(t);
|
||||
}
|
||||
|
||||
if(n == static_cast<unsigned long long>(1u))
|
||||
if(n == static_cast<boost::ulong_long_type>(1u))
|
||||
{
|
||||
neg = b_neg;
|
||||
return *this;
|
||||
@@ -1050,9 +1050,9 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
|
||||
}
|
||||
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, ExponentType, Allocator>::div_unsigned_long_long(const unsigned long long n)
|
||||
cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, ExponentType, Allocator>::div_unsigned_long_long(const boost::ulong_long_type n)
|
||||
{
|
||||
// Divide *this by a constant unsigned long long.
|
||||
// Divide *this by a constant boost::ulong_long_type.
|
||||
|
||||
// Evaluate the sign of the result.
|
||||
const bool b_neg = neg;
|
||||
@@ -1074,7 +1074,7 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
|
||||
return *this;
|
||||
}
|
||||
|
||||
if(n == static_cast<unsigned long long>(0u))
|
||||
if(n == static_cast<boost::ulong_long_type>(0u))
|
||||
{
|
||||
// Divide by 0.
|
||||
if(iszero())
|
||||
@@ -1096,7 +1096,7 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
|
||||
return *this;
|
||||
}
|
||||
|
||||
if(n >= static_cast<unsigned long long>(cpp_dec_float_elem_mask))
|
||||
if(n >= static_cast<boost::ulong_long_type>(cpp_dec_float_elem_mask))
|
||||
{
|
||||
neg = b_neg;
|
||||
cpp_dec_float t;
|
||||
@@ -1584,58 +1584,58 @@ long double cpp_dec_float<Digits10, ExponentType, Allocator>::extract_long_doubl
|
||||
}
|
||||
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
signed long long cpp_dec_float<Digits10, ExponentType, Allocator>::extract_signed_long_long() const
|
||||
boost::long_long_type cpp_dec_float<Digits10, ExponentType, Allocator>::extract_signed_long_long() const
|
||||
{
|
||||
// Extracts a signed long long from *this.
|
||||
// If (x > maximum of signed long long) or (x < minimum of signed long long),
|
||||
// then the maximum or minimum of signed long long is returned accordingly.
|
||||
// If (x > maximum of long long) or (x < minimum of long long),
|
||||
// then the maximum or minimum of long long is returned accordingly.
|
||||
|
||||
if(exp < static_cast<ExponentType>(0))
|
||||
{
|
||||
return static_cast<signed long long>(0);
|
||||
return static_cast<boost::long_long_type>(0);
|
||||
}
|
||||
|
||||
const bool b_neg = isneg();
|
||||
|
||||
unsigned long long val;
|
||||
boost::ulong_long_type val;
|
||||
|
||||
if((!b_neg) && (compare(long_long_max()) > 0))
|
||||
{
|
||||
return (std::numeric_limits<signed long long>::max)();
|
||||
return (std::numeric_limits<boost::long_long_type>::max)();
|
||||
}
|
||||
else if(b_neg && (compare(long_long_min()) < 0))
|
||||
{
|
||||
return (std::numeric_limits<signed long long>::min)();
|
||||
return (std::numeric_limits<boost::long_long_type>::min)();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Extract the data into an unsigned long long value.
|
||||
// Extract the data into an boost::ulong_long_type value.
|
||||
cpp_dec_float<Digits10, ExponentType, Allocator> xn(extract_integer_part());
|
||||
if(xn.isneg())
|
||||
xn.negate();
|
||||
|
||||
val = static_cast<unsigned long long>(xn.data[0]);
|
||||
val = static_cast<boost::ulong_long_type>(xn.data[0]);
|
||||
|
||||
const boost::int32_t imax = (std::min)(static_cast<boost::int32_t>(static_cast<boost::int32_t>(xn.exp) / cpp_dec_float_elem_digits10), static_cast<boost::int32_t>(cpp_dec_float_elem_number - static_cast<boost::int32_t>(1)));
|
||||
|
||||
for(boost::int32_t i = static_cast<boost::int32_t>(1); i <= imax; i++)
|
||||
{
|
||||
val *= static_cast<unsigned long long>(cpp_dec_float_elem_mask);
|
||||
val += static_cast<unsigned long long>(xn.data[i]);
|
||||
val *= static_cast<boost::ulong_long_type>(cpp_dec_float_elem_mask);
|
||||
val += static_cast<boost::ulong_long_type>(xn.data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!b_neg)
|
||||
{
|
||||
return static_cast<signed long long>(val);
|
||||
return static_cast<boost::long_long_type>(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This strange expression avoids a hardware trap in the corner case
|
||||
// that val is the most negative value permitted in long long.
|
||||
// that val is the most negative value permitted in boost::long_long_type.
|
||||
// See https://svn.boost.org/trac/boost/ticket/9740.
|
||||
//
|
||||
signed long long sval = static_cast<signed long long>(val - 1);
|
||||
boost::long_long_type sval = static_cast<boost::long_long_type>(val - 1);
|
||||
sval = -sval;
|
||||
--sval;
|
||||
return sval;
|
||||
@@ -1643,43 +1643,43 @@ signed long long cpp_dec_float<Digits10, ExponentType, Allocator>::extract_signe
|
||||
}
|
||||
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
unsigned long long cpp_dec_float<Digits10, ExponentType, Allocator>::extract_unsigned_long_long() const
|
||||
boost::ulong_long_type cpp_dec_float<Digits10, ExponentType, Allocator>::extract_unsigned_long_long() const
|
||||
{
|
||||
// Extracts an unsigned long long from *this.
|
||||
// If x exceeds the maximum of unsigned long long,
|
||||
// then the maximum of unsigned long long is returned.
|
||||
// If x is negative, then the unsigned long long cast of
|
||||
// the signed long long extracted value is returned.
|
||||
// Extracts an boost::ulong_long_type from *this.
|
||||
// If x exceeds the maximum of boost::ulong_long_type,
|
||||
// then the maximum of boost::ulong_long_type is returned.
|
||||
// If x is negative, then the boost::ulong_long_type cast of
|
||||
// the long long extracted value is returned.
|
||||
|
||||
if(isneg())
|
||||
{
|
||||
return static_cast<unsigned long long>(extract_signed_long_long());
|
||||
return static_cast<boost::ulong_long_type>(extract_signed_long_long());
|
||||
}
|
||||
|
||||
if(exp < static_cast<ExponentType>(0))
|
||||
{
|
||||
return static_cast<unsigned long long>(0u);
|
||||
return static_cast<boost::ulong_long_type>(0u);
|
||||
}
|
||||
|
||||
const cpp_dec_float<Digits10, ExponentType, Allocator> xn(extract_integer_part());
|
||||
|
||||
unsigned long long val;
|
||||
boost::ulong_long_type val;
|
||||
|
||||
if(xn.compare(ulong_long_max()) > 0)
|
||||
{
|
||||
return (std::numeric_limits<unsigned long long>::max)();
|
||||
return (std::numeric_limits<boost::ulong_long_type>::max)();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Extract the data into an unsigned long long value.
|
||||
val = static_cast<unsigned long long>(xn.data[0]);
|
||||
// Extract the data into an boost::ulong_long_type value.
|
||||
val = static_cast<boost::ulong_long_type>(xn.data[0]);
|
||||
|
||||
const boost::int32_t imax = (std::min)(static_cast<boost::int32_t>(static_cast<boost::int32_t>(xn.exp) / cpp_dec_float_elem_digits10), static_cast<boost::int32_t>(cpp_dec_float_elem_number - static_cast<boost::int32_t>(1)));
|
||||
|
||||
for(boost::int32_t i = static_cast<boost::int32_t>(1); i <= imax; i++)
|
||||
{
|
||||
val *= static_cast<unsigned long long>(cpp_dec_float_elem_mask);
|
||||
val += static_cast<unsigned long long>(xn.data[i]);
|
||||
val *= static_cast<boost::ulong_long_type>(cpp_dec_float_elem_mask);
|
||||
val += static_cast<boost::ulong_long_type>(xn.data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2209,8 +2209,8 @@ cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float(const double man
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, ExponentType, Allocator>::operator= (long double a)
|
||||
{
|
||||
// Christopher Kormanyos's original code used a cast to long long here, but that fails
|
||||
// when long double has more digits than a long long.
|
||||
// Christopher Kormanyos's original code used a cast to boost::long_long_type here, but that fails
|
||||
// when long double has more digits than a boost::long_long_type.
|
||||
using std::frexp;
|
||||
using std::ldexp;
|
||||
using std::floor;
|
||||
@@ -2259,7 +2259,7 @@ cpp_dec_float<Digits10, ExponentType, Allocator>& cpp_dec_float<Digits10, Expone
|
||||
}
|
||||
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
void cpp_dec_float<Digits10, ExponentType, Allocator>::from_unsigned_long_long(const unsigned long long u)
|
||||
void cpp_dec_float<Digits10, ExponentType, Allocator>::from_unsigned_long_long(const boost::ulong_long_type u)
|
||||
{
|
||||
std::fill(data.begin(), data.end(), static_cast<boost::uint32_t>(0u));
|
||||
|
||||
@@ -2270,14 +2270,14 @@ void cpp_dec_float<Digits10, ExponentType, Allocator>::from_unsigned_long_long(c
|
||||
|
||||
std::size_t i =static_cast<std::size_t>(0u);
|
||||
|
||||
unsigned long long uu = u;
|
||||
boost::ulong_long_type uu = u;
|
||||
|
||||
boost::uint32_t temp[(std::numeric_limits<unsigned long long>::digits10 / static_cast<int>(cpp_dec_float_elem_digits10)) + 3] = { static_cast<boost::uint32_t>(0u) };
|
||||
boost::uint32_t temp[(std::numeric_limits<boost::ulong_long_type>::digits10 / static_cast<int>(cpp_dec_float_elem_digits10)) + 3] = { static_cast<boost::uint32_t>(0u) };
|
||||
|
||||
while(uu != static_cast<unsigned long long>(0u))
|
||||
while(uu != static_cast<boost::ulong_long_type>(0u))
|
||||
{
|
||||
temp[i] = static_cast<boost::uint32_t>(uu % static_cast<unsigned long long>(cpp_dec_float_elem_mask));
|
||||
uu = static_cast<unsigned long long>(uu / static_cast<unsigned long long>(cpp_dec_float_elem_mask));
|
||||
temp[i] = static_cast<boost::uint32_t>(uu % static_cast<boost::ulong_long_type>(cpp_dec_float_elem_mask));
|
||||
uu = static_cast<boost::ulong_long_type>(uu / static_cast<boost::ulong_long_type>(cpp_dec_float_elem_mask));
|
||||
++i;
|
||||
}
|
||||
|
||||
@@ -2351,7 +2351,7 @@ boost::uint32_t cpp_dec_float<Digits10, ExponentType, Allocator>::div_loop_n(boo
|
||||
}
|
||||
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
cpp_dec_float<Digits10, ExponentType, Allocator> cpp_dec_float<Digits10, ExponentType, Allocator>::pow2(const long long p)
|
||||
cpp_dec_float<Digits10, ExponentType, Allocator> cpp_dec_float<Digits10, ExponentType, Allocator>::pow2(const boost::long_long_type p)
|
||||
{
|
||||
// Create a static const table of p^2 for -128 < p < +128.
|
||||
// Note: The size of this table must be odd-numbered and
|
||||
@@ -2488,24 +2488,24 @@ cpp_dec_float<Digits10, ExponentType, Allocator> cpp_dec_float<Digits10, Exponen
|
||||
cpp_dec_float("0.5"),
|
||||
one(),
|
||||
two(),
|
||||
cpp_dec_float(static_cast<unsigned long long>(4)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(8)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(16)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(32)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(64)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(128)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(256)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(512)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(1024)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(2048)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(4096)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(8192)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(16384)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(32768)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(65536)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(131072)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(262144)),
|
||||
cpp_dec_float(static_cast<unsigned long long>(524288)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(4)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(8)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(16)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(32)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(64)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(128)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(256)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(512)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(1024)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(2048)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(4096)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(8192)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(16384)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(32768)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(65536)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(131072)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(262144)),
|
||||
cpp_dec_float(static_cast<boost::ulong_long_type>(524288)),
|
||||
cpp_dec_float(static_cast<boost::uint64_t>(1uL << 20u)),
|
||||
cpp_dec_float(static_cast<boost::uint64_t>(1uL << 21u)),
|
||||
cpp_dec_float(static_cast<boost::uint64_t>(1uL << 22u)),
|
||||
@@ -2616,16 +2616,16 @@ cpp_dec_float<Digits10, ExponentType, Allocator> cpp_dec_float<Digits10, Exponen
|
||||
cpp_dec_float("1.701411834604692317316873037158841057280000000000000000000000000000000000000000000000000000000000000e38")
|
||||
}};
|
||||
|
||||
if((p > static_cast<long long>(-128)) && (p < static_cast<long long>(+128)))
|
||||
if((p > static_cast<boost::long_long_type>(-128)) && (p < static_cast<boost::long_long_type>(+128)))
|
||||
{
|
||||
return p2_data[static_cast<std::size_t>(p + ((p2_data.size() - 1u) / 2u))];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Compute and return 2^p.
|
||||
if(p < static_cast<long long>(0))
|
||||
if(p < static_cast<boost::long_long_type>(0))
|
||||
{
|
||||
return pow2(static_cast<long long>(-p)).calculate_inv();
|
||||
return pow2(static_cast<boost::long_long_type>(-p)).calculate_inv();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2659,28 +2659,28 @@ inline void eval_divide(cpp_dec_float<Digits10, ExponentType, Allocator>& result
|
||||
}
|
||||
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
inline void eval_add(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const unsigned long long& o)
|
||||
inline void eval_add(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const boost::ulong_long_type& o)
|
||||
{
|
||||
result.add_unsigned_long_long(o);
|
||||
}
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
inline void eval_subtract(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const unsigned long long& o)
|
||||
inline void eval_subtract(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const boost::ulong_long_type& o)
|
||||
{
|
||||
result.sub_unsigned_long_long(o);
|
||||
}
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
inline void eval_multiply(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const unsigned long long& o)
|
||||
inline void eval_multiply(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const boost::ulong_long_type& o)
|
||||
{
|
||||
result.mul_unsigned_long_long(o);
|
||||
}
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
inline void eval_divide(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const unsigned long long& o)
|
||||
inline void eval_divide(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const boost::ulong_long_type& o)
|
||||
{
|
||||
result.div_unsigned_long_long(o);
|
||||
}
|
||||
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
inline void eval_add(cpp_dec_float<Digits10, ExponentType, Allocator>& result, long long o)
|
||||
inline void eval_add(cpp_dec_float<Digits10, ExponentType, Allocator>& result, boost::long_long_type o)
|
||||
{
|
||||
if(o < 0)
|
||||
result.sub_unsigned_long_long(boost::multiprecision::detail::unsigned_abs(o));
|
||||
@@ -2688,7 +2688,7 @@ inline void eval_add(cpp_dec_float<Digits10, ExponentType, Allocator>& result, l
|
||||
result.add_unsigned_long_long(o);
|
||||
}
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
inline void eval_subtract(cpp_dec_float<Digits10, ExponentType, Allocator>& result, long long o)
|
||||
inline void eval_subtract(cpp_dec_float<Digits10, ExponentType, Allocator>& result, boost::long_long_type o)
|
||||
{
|
||||
if(o < 0)
|
||||
result.add_unsigned_long_long(boost::multiprecision::detail::unsigned_abs(o));
|
||||
@@ -2696,7 +2696,7 @@ inline void eval_subtract(cpp_dec_float<Digits10, ExponentType, Allocator>& resu
|
||||
result.sub_unsigned_long_long(o);
|
||||
}
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
inline void eval_multiply(cpp_dec_float<Digits10, ExponentType, Allocator>& result, long long o)
|
||||
inline void eval_multiply(cpp_dec_float<Digits10, ExponentType, Allocator>& result, boost::long_long_type o)
|
||||
{
|
||||
if(o < 0)
|
||||
{
|
||||
@@ -2707,7 +2707,7 @@ inline void eval_multiply(cpp_dec_float<Digits10, ExponentType, Allocator>& resu
|
||||
result.mul_unsigned_long_long(o);
|
||||
}
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
inline void eval_divide(cpp_dec_float<Digits10, ExponentType, Allocator>& result, long long o)
|
||||
inline void eval_divide(cpp_dec_float<Digits10, ExponentType, Allocator>& result, boost::long_long_type o)
|
||||
{
|
||||
if(o < 0)
|
||||
{
|
||||
@@ -2719,12 +2719,12 @@ inline void eval_divide(cpp_dec_float<Digits10, ExponentType, Allocator>& result
|
||||
}
|
||||
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
inline void eval_convert_to(unsigned long long* result, const cpp_dec_float<Digits10, ExponentType, Allocator>& val)
|
||||
inline void eval_convert_to(boost::ulong_long_type* result, const cpp_dec_float<Digits10, ExponentType, Allocator>& val)
|
||||
{
|
||||
*result = val.extract_unsigned_long_long();
|
||||
}
|
||||
template <unsigned Digits10, class ExponentType, class Allocator>
|
||||
inline void eval_convert_to(long long* result, const cpp_dec_float<Digits10, ExponentType, Allocator>& val)
|
||||
inline void eval_convert_to(boost::long_long_type* result, const cpp_dec_float<Digits10, ExponentType, Allocator>& val)
|
||||
{
|
||||
*result = val.extract_signed_long_long();
|
||||
}
|
||||
@@ -2834,18 +2834,18 @@ inline void eval_scalbn(cpp_dec_float<Digits10, ExponentType, Allocator>& result
|
||||
template <unsigned Digits10, class ExponentType, class Allocator, class ArgType>
|
||||
inline void eval_ldexp(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const cpp_dec_float<Digits10, ExponentType, Allocator>& x, ArgType e)
|
||||
{
|
||||
const long long the_exp = static_cast<long long>(e);
|
||||
const boost::long_long_type the_exp = static_cast<boost::long_long_type>(e);
|
||||
|
||||
if((the_exp > (std::numeric_limits<ExponentType>::max)()) || (the_exp < (std::numeric_limits<ExponentType>::min)()))
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error(std::string("Exponent value is out of range.")));
|
||||
|
||||
result = x;
|
||||
|
||||
if ((the_exp > static_cast<long long>(-std::numeric_limits<long long>::digits)) && (the_exp < static_cast<long long>(0)))
|
||||
result.div_unsigned_long_long(1ULL << static_cast<long long>(-the_exp));
|
||||
else if((the_exp < static_cast<long long>( std::numeric_limits<long long>::digits)) && (the_exp > static_cast<long long>(0)))
|
||||
if ((the_exp > static_cast<boost::long_long_type>(-std::numeric_limits<boost::long_long_type>::digits)) && (the_exp < static_cast<boost::long_long_type>(0)))
|
||||
result.div_unsigned_long_long(1ULL << static_cast<boost::long_long_type>(-the_exp));
|
||||
else if((the_exp < static_cast<boost::long_long_type>( std::numeric_limits<boost::long_long_type>::digits)) && (the_exp > static_cast<boost::long_long_type>(0)))
|
||||
result.mul_unsigned_long_long(1ULL << the_exp);
|
||||
else if(the_exp != static_cast<long long>(0))
|
||||
else if(the_exp != static_cast<boost::long_long_type>(0))
|
||||
result *= cpp_dec_float<Digits10, ExponentType, Allocator>::pow2(e);
|
||||
}
|
||||
|
||||
|
||||
@@ -689,7 +689,7 @@ const bool cpp_int_base<MinBits, MinBits, unsigned_magnitude, Checked, void, fal
|
||||
#endif
|
||||
//
|
||||
// Traits classes to figure out a native type with N bits, these vary from boost::uint_t<N> only
|
||||
// because some platforms have native integer types longer than long long, "really long long" anyone??
|
||||
// because some platforms have native integer types longer than boost::long_long_type, "really boost::long_long_type" anyone??
|
||||
//
|
||||
template <unsigned N, bool s>
|
||||
struct trivial_limb_type_imp
|
||||
@@ -704,7 +704,7 @@ struct trivial_limb_type_imp<N, true>
|
||||
};
|
||||
|
||||
template <unsigned N>
|
||||
struct trivial_limb_type : public trivial_limb_type_imp<N, N <= sizeof(long long) * CHAR_BIT> {};
|
||||
struct trivial_limb_type : public trivial_limb_type_imp<N, N <= sizeof(boost::long_long_type) * CHAR_BIT> {};
|
||||
//
|
||||
// Backend for fixed precision signed-magnitude type which will fit entirely inside a "double_limb_type":
|
||||
//
|
||||
@@ -1025,13 +1025,13 @@ public:
|
||||
trivial_tag,
|
||||
mpl::list<
|
||||
signed char, short, int, long,
|
||||
long long, signed_double_limb_type>,
|
||||
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,
|
||||
unsigned long, unsigned long long, double_limb_type>,
|
||||
unsigned long, boost::ulong_long_type, double_limb_type>,
|
||||
mpl::list<limb_type, double_limb_type>
|
||||
>::type unsigned_types;
|
||||
typedef typename mpl::if_<
|
||||
|
||||
@@ -128,7 +128,7 @@ inline A checked_divide(A a, A b, const mpl::int_<unchecked>&)
|
||||
}
|
||||
|
||||
template <class A>
|
||||
inline A checked_left_shift(A a, unsigned long long shift, const mpl::int_<checked>&)
|
||||
inline A checked_left_shift(A a, boost::ulong_long_type shift, const mpl::int_<checked>&)
|
||||
{
|
||||
if(a && shift)
|
||||
{
|
||||
@@ -138,7 +138,7 @@ inline A checked_left_shift(A a, unsigned long long shift, const mpl::int_<check
|
||||
return a << shift;
|
||||
}
|
||||
template <class A>
|
||||
inline A checked_left_shift(A a, unsigned long long shift, const mpl::int_<unchecked>&)
|
||||
inline A checked_left_shift(A a, boost::ulong_long_type shift, const mpl::int_<unchecked>&)
|
||||
{
|
||||
return (shift >= sizeof(A) * CHAR_BIT) ? 0 : a << shift;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace detail{
|
||||
|
||||
//
|
||||
// These traits calculate the largest type in the list
|
||||
// [unsigned] long long, long, int, which has the specified number
|
||||
// [unsigned] boost::long_long_type, long, int, which has the specified number
|
||||
// of bits. Note that intN_t and boost::int_t<N> find the first
|
||||
// member of the above list, not the last. We want the last in the
|
||||
// list to ensure that mixed arithmetic operations are as efficient
|
||||
@@ -29,8 +29,8 @@ template <unsigned N>
|
||||
struct largest_signed_type
|
||||
{
|
||||
typedef typename mpl::if_c<
|
||||
1 + std::numeric_limits<long long>::digits == N,
|
||||
long long,
|
||||
1 + std::numeric_limits<boost::long_long_type>::digits == N,
|
||||
boost::long_long_type,
|
||||
typename mpl::if_c<
|
||||
1 + std::numeric_limits<long>::digits == N,
|
||||
long,
|
||||
@@ -47,8 +47,8 @@ template <unsigned N>
|
||||
struct largest_unsigned_type
|
||||
{
|
||||
typedef typename mpl::if_c<
|
||||
std::numeric_limits<unsigned long long>::digits == N,
|
||||
unsigned long long,
|
||||
std::numeric_limits<boost::ulong_long_type>::digits == N,
|
||||
boost::ulong_long_type,
|
||||
typename mpl::if_c<
|
||||
std::numeric_limits<unsigned long>::digits == N,
|
||||
unsigned long,
|
||||
|
||||
@@ -124,7 +124,7 @@ BOOST_FORCEINLINE unsigned find_lsb(unsigned long mask, mpl::int_<2> const&)
|
||||
{
|
||||
return __builtin_ctzl(mask);
|
||||
}
|
||||
BOOST_FORCEINLINE unsigned find_lsb(unsigned long long mask, mpl::int_<3> const&)
|
||||
BOOST_FORCEINLINE unsigned find_lsb(boost::ulong_long_type mask, mpl::int_<3> const&)
|
||||
{
|
||||
return __builtin_ctzll(mask);
|
||||
}
|
||||
@@ -136,9 +136,9 @@ BOOST_FORCEINLINE unsigned find_msb(unsigned long mask, mpl::int_<2> const&)
|
||||
{
|
||||
return sizeof(unsigned long) * CHAR_BIT - 1 - __builtin_clzl(mask);
|
||||
}
|
||||
BOOST_FORCEINLINE unsigned find_msb(unsigned long long mask, mpl::int_<3> const&)
|
||||
BOOST_FORCEINLINE unsigned find_msb(boost::ulong_long_type mask, mpl::int_<3> const&)
|
||||
{
|
||||
return sizeof(unsigned long long) * CHAR_BIT - 1 - __builtin_clzll(mask);
|
||||
return sizeof(boost::ulong_long_type) * CHAR_BIT - 1 - __builtin_clzll(mask);
|
||||
}
|
||||
|
||||
template <class Unsigned>
|
||||
@@ -152,7 +152,7 @@ BOOST_FORCEINLINE unsigned find_lsb(Unsigned mask)
|
||||
sizeof(Unsigned) <= sizeof(unsigned long),
|
||||
mpl::int_<2>,
|
||||
typename mpl::if_c<
|
||||
sizeof(Unsigned) <= sizeof(unsigned long long),
|
||||
sizeof(Unsigned) <= sizeof(boost::ulong_long_type),
|
||||
mpl::int_<3>,
|
||||
mpl::int_<0>
|
||||
>::type
|
||||
@@ -171,7 +171,7 @@ BOOST_FORCEINLINE unsigned find_msb(Unsigned mask)
|
||||
sizeof(Unsigned) <= sizeof(unsigned long),
|
||||
mpl::int_<2>,
|
||||
typename mpl::if_c<
|
||||
sizeof(Unsigned) <= sizeof(unsigned long long),
|
||||
sizeof(Unsigned) <= sizeof(boost::ulong_long_type),
|
||||
mpl::int_<3>,
|
||||
mpl::int_<0>
|
||||
>::type
|
||||
|
||||
@@ -1219,7 +1219,7 @@ inline typename B::exponent_type eval_ilogb(const B& val)
|
||||
template <class B>
|
||||
inline void eval_logb(B& result, const B& val)
|
||||
{
|
||||
typedef typename boost::mpl::if_c<boost::is_same<boost::intmax_t, long>::value, long long, boost::intmax_t>::type max_t;
|
||||
typedef typename boost::mpl::if_c<boost::is_same<boost::intmax_t, long>::value, boost::long_long_type, boost::intmax_t>::type max_t;
|
||||
result = static_cast<max_t>(eval_ilogb(val));
|
||||
}
|
||||
template <class B, class A>
|
||||
@@ -1436,29 +1436,29 @@ inline long ltrunc(const number<T, ExpressionTemplates>& v)
|
||||
}
|
||||
#ifndef BOOST_NO_LONG_LONG
|
||||
template <class tag, class A1, class A2, class A3, class A4, class Policy>
|
||||
inline long long lltrunc(const detail::expression<tag, A1, A2, A3, A4>& v, const Policy& pol)
|
||||
inline boost::long_long_type lltrunc(const detail::expression<tag, A1, A2, A3, A4>& v, const Policy& pol)
|
||||
{
|
||||
typedef typename detail::expression<tag, A1, A2, A3, A4>::result_type number_type;
|
||||
number_type r = trunc(v, pol);
|
||||
if((r > (std::numeric_limits<long long>::max)()) || r < (std::numeric_limits<long long>::min)() || !(boost::math::isfinite)(v))
|
||||
if((r > (std::numeric_limits<boost::long_long_type>::max)()) || r < (std::numeric_limits<boost::long_long_type>::min)() || !(boost::math::isfinite)(v))
|
||||
return boost::math::policies::raise_rounding_error("boost::multiprecision::lltrunc<%1%>(%1%)", 0, number_type(v), 0LL, pol);
|
||||
return r.template convert_to<long long>();
|
||||
return r.template convert_to<boost::long_long_type>();
|
||||
}
|
||||
template <class tag, class A1, class A2, class A3, class A4>
|
||||
inline long long lltrunc(const detail::expression<tag, A1, A2, A3, A4>& v)
|
||||
inline boost::long_long_type lltrunc(const detail::expression<tag, A1, A2, A3, A4>& v)
|
||||
{
|
||||
return lltrunc(v, boost::math::policies::policy<>());
|
||||
}
|
||||
template <class T, expression_template_option ExpressionTemplates, class Policy>
|
||||
inline long long lltrunc(const number<T, ExpressionTemplates>& v, const Policy& pol)
|
||||
inline boost::long_long_type lltrunc(const number<T, ExpressionTemplates>& v, const Policy& pol)
|
||||
{
|
||||
number<T, ExpressionTemplates> r = trunc(v, pol);
|
||||
if((r > (std::numeric_limits<long long>::max)()) || r < (std::numeric_limits<long long>::min)() || !(boost::math::isfinite)(v))
|
||||
if((r > (std::numeric_limits<boost::long_long_type>::max)()) || r < (std::numeric_limits<boost::long_long_type>::min)() || !(boost::math::isfinite)(v))
|
||||
return boost::math::policies::raise_rounding_error("boost::multiprecision::lltrunc<%1%>(%1%)", 0, v, 0LL, pol);
|
||||
return r.template convert_to<long long>();
|
||||
return r.template convert_to<boost::long_long_type>();
|
||||
}
|
||||
template <class T, expression_template_option ExpressionTemplates>
|
||||
inline long long lltrunc(const number<T, ExpressionTemplates>& v)
|
||||
inline boost::long_long_type lltrunc(const number<T, ExpressionTemplates>& v)
|
||||
{
|
||||
return lltrunc(v, boost::math::policies::policy<>());
|
||||
}
|
||||
@@ -1534,29 +1534,29 @@ inline long lround(const number<T, ExpressionTemplates>& v)
|
||||
}
|
||||
#ifndef BOOST_NO_LONG_LONG
|
||||
template <class tag, class A1, class A2, class A3, class A4, class Policy>
|
||||
inline long long llround(const detail::expression<tag, A1, A2, A3, A4>& v, const Policy& pol)
|
||||
inline boost::long_long_type llround(const detail::expression<tag, A1, A2, A3, A4>& v, const Policy& pol)
|
||||
{
|
||||
typedef typename detail::expression<tag, A1, A2, A3, A4>::result_type number_type;
|
||||
number_type r = round(v, pol);
|
||||
if((r > (std::numeric_limits<long long>::max)()) || r < (std::numeric_limits<long long>::min)() || !(boost::math::isfinite)(v))
|
||||
if((r > (std::numeric_limits<boost::long_long_type>::max)()) || r < (std::numeric_limits<boost::long_long_type>::min)() || !(boost::math::isfinite)(v))
|
||||
return boost::math::policies::raise_rounding_error("boost::multiprecision::iround<%1%>(%1%)", 0, number_type(v), 0LL, pol);
|
||||
return r.template convert_to<long long>();
|
||||
return r.template convert_to<boost::long_long_type>();
|
||||
}
|
||||
template <class tag, class A1, class A2, class A3, class A4>
|
||||
inline long long llround(const detail::expression<tag, A1, A2, A3, A4>& v)
|
||||
inline boost::long_long_type llround(const detail::expression<tag, A1, A2, A3, A4>& v)
|
||||
{
|
||||
return llround(v, boost::math::policies::policy<>());
|
||||
}
|
||||
template <class T, expression_template_option ExpressionTemplates, class Policy>
|
||||
inline long long llround(const number<T, ExpressionTemplates>& v, const Policy& pol)
|
||||
inline boost::long_long_type llround(const number<T, ExpressionTemplates>& v, const Policy& pol)
|
||||
{
|
||||
number<T, ExpressionTemplates> r = round(v, pol);
|
||||
if((r > (std::numeric_limits<long long>::max)()) || r < (std::numeric_limits<long long>::min)() || !(boost::math::isfinite)(v))
|
||||
if((r > (std::numeric_limits<boost::long_long_type>::max)()) || r < (std::numeric_limits<boost::long_long_type>::min)() || !(boost::math::isfinite)(v))
|
||||
return boost::math::policies::raise_rounding_error("boost::multiprecision::iround<%1%>(%1%)", 0, v, 0LL, pol);
|
||||
return r.template convert_to<long long>();
|
||||
return r.template convert_to<boost::long_long_type>();
|
||||
}
|
||||
template <class T, expression_template_option ExpressionTemplates>
|
||||
inline long long llround(const number<T, ExpressionTemplates>& v)
|
||||
inline boost::long_long_type llround(const number<T, ExpressionTemplates>& v)
|
||||
{
|
||||
return llround(v, boost::math::policies::policy<>());
|
||||
}
|
||||
@@ -1612,7 +1612,7 @@ frexp(const detail::expression<tag, A1, A2, A3, A4>& v, long* pint)
|
||||
return BOOST_MP_MOVE(frexp(static_cast<number_type>(v), pint));
|
||||
}
|
||||
template <class T, expression_template_option ExpressionTemplates>
|
||||
inline typename enable_if_c<number_category<T>::value == number_kind_floating_point, number<T, ExpressionTemplates> >::type frexp(const number<T, ExpressionTemplates>& v, long long* pint)
|
||||
inline typename enable_if_c<number_category<T>::value == number_kind_floating_point, number<T, ExpressionTemplates> >::type frexp(const number<T, ExpressionTemplates>& v, boost::long_long_type* pint)
|
||||
{
|
||||
using default_ops::eval_frexp;
|
||||
number<T, ExpressionTemplates> result;
|
||||
@@ -1621,7 +1621,7 @@ inline typename enable_if_c<number_category<T>::value == number_kind_floating_po
|
||||
}
|
||||
template <class tag, class A1, class A2, class A3, class A4>
|
||||
inline typename enable_if_c<number_category<typename detail::expression<tag, A1, A2, A3, A4>::result_type>::value == number_kind_floating_point, typename detail::expression<tag, A1, A2, A3, A4>::result_type>::type
|
||||
frexp(const detail::expression<tag, A1, A2, A3, A4>& v, long long* pint)
|
||||
frexp(const detail::expression<tag, A1, A2, A3, A4>& v, boost::long_long_type* pint)
|
||||
{
|
||||
typedef typename detail::expression<tag, A1, A2, A3, A4>::result_type number_type;
|
||||
return BOOST_MP_MOVE(frexp(static_cast<number_type>(v), pint));
|
||||
@@ -2104,8 +2104,8 @@ HETERO_BINARY_OP_FUNCTOR_B(ldexp, int, number_kind_floating_point)
|
||||
//HETERO_BINARY_OP_FUNCTOR_B(frexp, int*, number_kind_floating_point)
|
||||
HETERO_BINARY_OP_FUNCTOR_B(ldexp, long, number_kind_floating_point)
|
||||
//HETERO_BINARY_OP_FUNCTOR_B(frexp, long*, number_kind_floating_point)
|
||||
HETERO_BINARY_OP_FUNCTOR_B(ldexp, long long, number_kind_floating_point)
|
||||
//HETERO_BINARY_OP_FUNCTOR_B(frexp, long long*, number_kind_floating_point)
|
||||
HETERO_BINARY_OP_FUNCTOR_B(ldexp, boost::long_long_type, number_kind_floating_point)
|
||||
//HETERO_BINARY_OP_FUNCTOR_B(frexp, boost::long_long_type*, number_kind_floating_point)
|
||||
BINARY_OP_FUNCTOR(pow, number_kind_floating_point)
|
||||
BINARY_OP_FUNCTOR(fmod, number_kind_floating_point)
|
||||
BINARY_OP_FUNCTOR(atan2, number_kind_floating_point)
|
||||
@@ -2114,7 +2114,7 @@ UNARY_OP_FUNCTOR(logb, number_kind_floating_point)
|
||||
HETERO_BINARY_OP_FUNCTOR(scalbn, short, number_kind_floating_point)
|
||||
HETERO_BINARY_OP_FUNCTOR_B(scalbn, int, number_kind_floating_point)
|
||||
HETERO_BINARY_OP_FUNCTOR_B(scalbn, long, number_kind_floating_point)
|
||||
HETERO_BINARY_OP_FUNCTOR_B(scalbn, long long, number_kind_floating_point)
|
||||
HETERO_BINARY_OP_FUNCTOR_B(scalbn, boost::long_long_type, number_kind_floating_point)
|
||||
|
||||
//
|
||||
// Integer functions:
|
||||
|
||||
@@ -392,7 +392,7 @@ template <class To, class From>
|
||||
void generic_interconvert_float2rational(To& to, const From& from, const mpl::int_<2>& /*radix*/)
|
||||
{
|
||||
typedef typename mpl::front<typename To::unsigned_types>::type ui_type;
|
||||
static const int shift = std::numeric_limits<long long>::digits;
|
||||
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;
|
||||
number<From> val(from);
|
||||
@@ -401,7 +401,7 @@ void generic_interconvert_float2rational(To& to, const From& from, const mpl::in
|
||||
{
|
||||
val = ldexp(val, shift);
|
||||
e -= shift;
|
||||
long long ll = boost::math::lltrunc(val);
|
||||
boost::long_long_type ll = boost::math::lltrunc(val);
|
||||
val -= ll;
|
||||
num <<= shift;
|
||||
num += ll;
|
||||
@@ -430,7 +430,7 @@ void generic_interconvert_float2rational(To& to, const From& from, const mpl::in
|
||||
val = scalbn(val, -e);
|
||||
while(val)
|
||||
{
|
||||
long long ll = boost::math::lltrunc(val);
|
||||
boost::long_long_type ll = boost::math::lltrunc(val);
|
||||
val -= ll;
|
||||
val = scalbn(val, 1);
|
||||
num *= Radix;
|
||||
|
||||
@@ -72,13 +72,13 @@ struct is_compatible_arithmetic_type
|
||||
|
||||
namespace detail{
|
||||
//
|
||||
// Workaround for missing abs(long long) and abs(__int128) on some compilers:
|
||||
// Workaround for missing abs(boost::long_long_type) and abs(__int128) on some compilers:
|
||||
//
|
||||
template <class T>
|
||||
BOOST_CONSTEXPR typename enable_if_c<(is_signed<T>::value || is_floating_point<T>::value), T>::type abs(T t) BOOST_NOEXCEPT
|
||||
{
|
||||
// This strange expression avoids a hardware trap in the corner case
|
||||
// that val is the most negative value permitted in long long.
|
||||
// that val is the most negative value permitted in boost::long_long_type.
|
||||
// See https://svn.boost.org/trac/boost/ticket/9740.
|
||||
return t < 0 ? T(1u) + T(-(t + 1)) : t;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ template <class T>
|
||||
BOOST_CONSTEXPR typename enable_if_c<(is_signed<T>::value || is_floating_point<T>::value), typename make_unsigned<T>::type>::type unsigned_abs(T t) BOOST_NOEXCEPT
|
||||
{
|
||||
// This strange expression avoids a hardware trap in the corner case
|
||||
// that val is the most negative value permitted in long long.
|
||||
// that val is the most negative value permitted in boost::long_long_type.
|
||||
// See https://svn.boost.org/trac/boost/ticket/9740.
|
||||
return t < 0 ? static_cast<typename make_unsigned<T>::type>(1u) + static_cast<typename make_unsigned<T>::type>(-(t + 1)) : static_cast<typename make_unsigned<T>::type>(t);
|
||||
}
|
||||
|
||||
@@ -127,9 +127,9 @@ namespace backends{
|
||||
|
||||
struct float128_backend
|
||||
{
|
||||
typedef mpl::list<signed char, short, int, long, long long> signed_types;
|
||||
typedef mpl::list<signed char, short, int, long, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<unsigned char, unsigned short,
|
||||
unsigned int, unsigned long, unsigned long long> unsigned_types;
|
||||
unsigned int, unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
typedef mpl::list<float, double, long double> float_types;
|
||||
typedef int exponent_type;
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ template <unsigned digits10>
|
||||
struct gmp_float_imp
|
||||
{
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
typedef mpl::list<long, long long> signed_types;
|
||||
typedef mpl::list<unsigned long, unsigned long long> unsigned_types;
|
||||
typedef mpl::list<long, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
#else
|
||||
typedef mpl::list<long> signed_types;
|
||||
typedef mpl::list<unsigned long> unsigned_types;
|
||||
@@ -108,16 +108,17 @@ struct gmp_float_imp
|
||||
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
#if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
|
||||
gmp_float_imp& operator = (unsigned long long i)
|
||||
gmp_float_imp& operator = (boost::ulong_long_type i)
|
||||
{
|
||||
*this = static_cast<unsigned long>(i);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
gmp_float_imp& operator = (unsigned long long i)
|
||||
gmp_float_imp& operator = (boost::ulong_long_type i)
|
||||
{
|
||||
if(m_data[0]._mp_d == 0)
|
||||
mpf_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : get_default_precision()));
|
||||
unsigned long long mask = ((((1uLL << (std::numeric_limits<unsigned long>::digits - 1)) - 1) << 1) | 1uLL);
|
||||
boost::ulong_long_type mask = ((((1uLL << (std::numeric_limits<unsigned long>::digits - 1)) - 1) << 1) | 1uLL);
|
||||
unsigned shift = 0;
|
||||
mpf_t t;
|
||||
mpf_init2(t, multiprecision::detail::digits10_2_2(digits10 ? digits10 : get_default_precision()));
|
||||
@@ -135,12 +136,12 @@ struct gmp_float_imp
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
gmp_float_imp& operator = (long long i)
|
||||
gmp_float_imp& operator = (boost::long_long_type i)
|
||||
{
|
||||
if(m_data[0]._mp_d == 0)
|
||||
mpf_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : get_default_precision()));
|
||||
bool neg = i < 0;
|
||||
*this = static_cast<unsigned long long>(boost::multiprecision::detail::unsigned_abs(i));
|
||||
*this = static_cast<boost::ulong_long_type>(boost::multiprecision::detail::unsigned_abs(i));
|
||||
if(neg)
|
||||
mpf_neg(m_data, m_data);
|
||||
return *this;
|
||||
@@ -858,13 +859,13 @@ inline void eval_convert_to(double* result, const gmp_float<digits10>& val) BOOS
|
||||
}
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
template <unsigned digits10>
|
||||
inline void eval_convert_to(long long* result, const gmp_float<digits10>& val)
|
||||
inline void eval_convert_to(boost::long_long_type* result, const gmp_float<digits10>& val)
|
||||
{
|
||||
gmp_float<digits10> t(val);
|
||||
if(eval_get_sign(t) < 0)
|
||||
t.negate();
|
||||
|
||||
long digits = std::numeric_limits<long long>::digits - std::numeric_limits<long>::digits;
|
||||
long digits = std::numeric_limits<boost::long_long_type>::digits - std::numeric_limits<long>::digits;
|
||||
|
||||
if(digits > 0)
|
||||
mpf_div_2exp(t.data(), t.data(), digits);
|
||||
@@ -872,9 +873,9 @@ inline void eval_convert_to(long long* result, const gmp_float<digits10>& val)
|
||||
if(!mpf_fits_slong_p(t.data()))
|
||||
{
|
||||
if(eval_get_sign(val) < 0)
|
||||
*result = (std::numeric_limits<long long>::min)();
|
||||
*result = (std::numeric_limits<boost::long_long_type>::min)();
|
||||
else
|
||||
*result = (std::numeric_limits<long long>::max)();
|
||||
*result = (std::numeric_limits<boost::long_long_type>::max)();
|
||||
return;
|
||||
};
|
||||
|
||||
@@ -893,18 +894,18 @@ inline void eval_convert_to(long long* result, const gmp_float<digits10>& val)
|
||||
*result = -*result;
|
||||
}
|
||||
template <unsigned digits10>
|
||||
inline void eval_convert_to(unsigned long long* result, const gmp_float<digits10>& val)
|
||||
inline void eval_convert_to(boost::ulong_long_type* result, const gmp_float<digits10>& val)
|
||||
{
|
||||
gmp_float<digits10> t(val);
|
||||
|
||||
long digits = std::numeric_limits<long long>::digits - std::numeric_limits<long>::digits;
|
||||
long digits = std::numeric_limits<boost::long_long_type>::digits - std::numeric_limits<long>::digits;
|
||||
|
||||
if(digits > 0)
|
||||
mpf_div_2exp(t.data(), t.data(), digits);
|
||||
|
||||
if(!mpf_fits_ulong_p(t.data()))
|
||||
{
|
||||
*result = (std::numeric_limits<long long>::max)();
|
||||
*result = (std::numeric_limits<boost::long_long_type>::max)();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -985,8 +986,8 @@ inline void eval_frexp(gmp_float<Digits10>& result, const gmp_float<Digits10>& v
|
||||
struct gmp_int
|
||||
{
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
typedef mpl::list<long, long long> signed_types;
|
||||
typedef mpl::list<unsigned long, unsigned long long> unsigned_types;
|
||||
typedef mpl::list<long, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
#else
|
||||
typedef mpl::list<long> signed_types;
|
||||
typedef mpl::list<unsigned long> unsigned_types;
|
||||
@@ -1048,16 +1049,17 @@ struct gmp_int
|
||||
#endif
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
#if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
|
||||
gmp_int& operator = (unsigned long long i)
|
||||
gmp_int& operator = (boost::ulong_long_type i)
|
||||
{
|
||||
*this = static_cast<unsigned long>(i);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
gmp_int& operator = (unsigned long long i)
|
||||
gmp_int& operator = (boost::ulong_long_type i)
|
||||
{
|
||||
if(m_data[0]._mp_d == 0)
|
||||
mpz_init(this->m_data);
|
||||
unsigned long long mask = ((((1uLL << (std::numeric_limits<unsigned long>::digits - 1)) - 1) << 1) | 1uLL);
|
||||
boost::ulong_long_type mask = ((((1uLL << (std::numeric_limits<unsigned long>::digits - 1)) - 1) << 1) | 1uLL);
|
||||
unsigned shift = 0;
|
||||
mpz_t t;
|
||||
mpz_set_ui(m_data, 0);
|
||||
@@ -1075,7 +1077,7 @@ struct gmp_int
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
gmp_int& operator = (long long i)
|
||||
gmp_int& operator = (boost::long_long_type i)
|
||||
{
|
||||
if(m_data[0]._mp_d == 0)
|
||||
mpz_init(this->m_data);
|
||||
@@ -1736,8 +1738,8 @@ void eval_add(gmp_rational& t, const gmp_rational& o);
|
||||
struct gmp_rational
|
||||
{
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
typedef mpl::list<long, long long> signed_types;
|
||||
typedef mpl::list<unsigned long, unsigned long long> unsigned_types;
|
||||
typedef mpl::list<long, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
#else
|
||||
typedef mpl::list<long> signed_types;
|
||||
typedef mpl::list<unsigned long> unsigned_types;
|
||||
@@ -1793,12 +1795,13 @@ struct gmp_rational
|
||||
#endif
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
#if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
|
||||
gmp_rational& operator = (unsigned long long i)
|
||||
gmp_rational& operator = (boost::ulong_long_type i)
|
||||
{
|
||||
*this = static_cast<unsigned long>(i);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
gmp_rational& operator = (unsigned long long i)
|
||||
gmp_rational& operator = (boost::ulong_long_type i)
|
||||
{
|
||||
if(m_data[0]._mp_den._mp_d == 0)
|
||||
mpq_init(m_data);
|
||||
@@ -1807,7 +1810,7 @@ struct gmp_rational
|
||||
mpq_set_z(m_data, zi.data());
|
||||
return *this;
|
||||
}
|
||||
gmp_rational& operator = (long long i)
|
||||
gmp_rational& operator = (boost::long_long_type i)
|
||||
{
|
||||
if(m_data[0]._mp_den._mp_d == 0)
|
||||
mpq_init(m_data);
|
||||
|
||||
@@ -48,17 +48,17 @@ namespace detail{
|
||||
//
|
||||
// Figure out the kind of integer that has twice as many bits as some builtin
|
||||
// integer type I. Use a native type if we can (including types which may not
|
||||
// be recognised by boost::int_t because they're larger than long long),
|
||||
// be recognised by boost::int_t because they're larger than boost::long_long_type),
|
||||
// otherwise synthesize a cpp_int to do the job.
|
||||
//
|
||||
template <class I>
|
||||
struct double_integer
|
||||
{
|
||||
static const unsigned int_t_digits =
|
||||
2 * sizeof(I) <= sizeof(long long) ? std::numeric_limits<I>::digits * 2 : 1;
|
||||
2 * sizeof(I) <= sizeof(boost::long_long_type) ? std::numeric_limits<I>::digits * 2 : 1;
|
||||
|
||||
typedef typename mpl::if_c<
|
||||
2 * sizeof(I) <= sizeof(long long),
|
||||
2 * sizeof(I) <= sizeof(boost::long_long_type),
|
||||
typename mpl::if_c<
|
||||
is_signed<I>::value,
|
||||
typename boost::int_t<int_t_digits>::least,
|
||||
|
||||
@@ -56,8 +56,8 @@ template <unsigned digits10>
|
||||
struct mpfi_float_imp
|
||||
{
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
typedef mpl::list<long, long long> signed_types;
|
||||
typedef mpl::list<unsigned long, unsigned long long> unsigned_types;
|
||||
typedef mpl::list<long, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
#else
|
||||
typedef mpl::list<long> signed_types;
|
||||
typedef mpl::list<unsigned long> unsigned_types;
|
||||
@@ -104,7 +104,7 @@ struct mpfi_float_imp
|
||||
#endif
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
#ifdef _MPFR_H_HAVE_INTMAX_T
|
||||
mpfi_float_imp& operator = (unsigned long long i)
|
||||
mpfi_float_imp& operator = (boost::ulong_long_type i)
|
||||
{
|
||||
if(m_data[0].left._mpfr_d == 0)
|
||||
mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : get_default_precision()));
|
||||
@@ -112,7 +112,7 @@ struct mpfi_float_imp
|
||||
mpfr_set_uj(right_data(), i, GMP_RNDU);
|
||||
return *this;
|
||||
}
|
||||
mpfi_float_imp& operator = (long long i)
|
||||
mpfi_float_imp& operator = (boost::long_long_type i)
|
||||
{
|
||||
if(m_data[0].left._mpfr_d == 0)
|
||||
mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : get_default_precision()));
|
||||
@@ -121,14 +121,14 @@ struct mpfi_float_imp
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
mpfi_float_imp& operator = (unsigned long long i)
|
||||
mpfi_float_imp& operator = (boost::ulong_long_type i)
|
||||
{
|
||||
if(m_data[0].left._mpfr_d == 0)
|
||||
mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : get_default_precision()));
|
||||
unsigned long long mask = (((1uLL << (std::numeric_limits<unsigned long>::digits - 1) - 1) << 1) | 1u);
|
||||
boost::ulong_long_type mask = (((1uLL << (std::numeric_limits<unsigned long>::digits - 1) - 1) << 1) | 1u);
|
||||
unsigned shift = 0;
|
||||
mpfi_t t;
|
||||
mpfi_init2(t, (std::max)(static_cast<unsigned>(std::numeric_limits<unsigned long long>::digits), static_cast<unsigned long>(multiprecision::detail::digits10_2_2(digits10))));
|
||||
mpfi_init2(t, (std::max)(static_cast<unsigned>(std::numeric_limits<boost::ulong_long_type>::digits), static_cast<unsigned long>(multiprecision::detail::digits10_2_2(digits10))));
|
||||
mpfi_set_ui(m_data, 0);
|
||||
while(i)
|
||||
{
|
||||
@@ -142,7 +142,7 @@ struct mpfi_float_imp
|
||||
mpfi_clear(t);
|
||||
return *this;
|
||||
}
|
||||
mpfi_float_imp& operator = (long long i)
|
||||
mpfi_float_imp& operator = (boost::long_long_type i)
|
||||
{
|
||||
if(m_data[0].left._mpfr_d == 0)
|
||||
mpfi_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : get_default_precision()));
|
||||
@@ -738,14 +738,14 @@ inline void eval_convert_to(long* result, const mpfi_float_backend<digits10>& va
|
||||
}
|
||||
#ifdef _MPFR_H_HAVE_INTMAX_T
|
||||
template <unsigned digits10>
|
||||
inline void eval_convert_to(unsigned long long* result, const mpfi_float_backend<digits10>& val)
|
||||
inline void eval_convert_to(boost::ulong_long_type* result, const mpfi_float_backend<digits10>& val)
|
||||
{
|
||||
mpfr_float_backend<digits10> t;
|
||||
mpfi_mid(t.data(), val.data());
|
||||
eval_convert_to(result, t);
|
||||
}
|
||||
template <unsigned digits10>
|
||||
inline void eval_convert_to(long long* result, const mpfi_float_backend<digits10>& val)
|
||||
inline void eval_convert_to(boost::long_long_type* result, const mpfi_float_backend<digits10>& val)
|
||||
{
|
||||
mpfr_float_backend<digits10> t;
|
||||
mpfi_mid(t.data(), val.data());
|
||||
|
||||
@@ -64,8 +64,8 @@ template <unsigned digits10>
|
||||
struct mpfr_float_imp<digits10, allocate_dynamic>
|
||||
{
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
typedef mpl::list<long, long long> signed_types;
|
||||
typedef mpl::list<unsigned long, unsigned long long> unsigned_types;
|
||||
typedef mpl::list<long, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
#else
|
||||
typedef mpl::list<long> signed_types;
|
||||
typedef mpl::list<unsigned long> unsigned_types;
|
||||
@@ -112,14 +112,14 @@ struct mpfr_float_imp<digits10, allocate_dynamic>
|
||||
#endif
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
#ifdef _MPFR_H_HAVE_INTMAX_T
|
||||
mpfr_float_imp& operator = (unsigned long long i)
|
||||
mpfr_float_imp& operator = (boost::ulong_long_type i)
|
||||
{
|
||||
if(m_data[0]._mpfr_d == 0)
|
||||
mpfr_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : get_default_precision()));
|
||||
mpfr_set_uj(m_data, i, GMP_RNDN);
|
||||
return *this;
|
||||
}
|
||||
mpfr_float_imp& operator = (long long i)
|
||||
mpfr_float_imp& operator = (boost::long_long_type i)
|
||||
{
|
||||
if(m_data[0]._mpfr_d == 0)
|
||||
mpfr_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : get_default_precision()));
|
||||
@@ -127,14 +127,14 @@ struct mpfr_float_imp<digits10, allocate_dynamic>
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
mpfr_float_imp& operator = (unsigned long long i)
|
||||
mpfr_float_imp& operator = (boost::ulong_long_type i)
|
||||
{
|
||||
if(m_data[0]._mpfr_d == 0)
|
||||
mpfr_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : get_default_precision()));
|
||||
unsigned long long mask = (((1uLL << (std::numeric_limits<unsigned long>::digits - 1) - 1) << 1) | 1uLL);
|
||||
boost::ulong_long_type mask = (((1uLL << (std::numeric_limits<unsigned long>::digits - 1) - 1) << 1) | 1uLL);
|
||||
unsigned shift = 0;
|
||||
mpfr_t t;
|
||||
mpfr_init2(t, (std::max)(static_cast<unsigned>(std::numeric_limits<unsigned long long>::digits), static_cast<unsigned long>(multiprecision::detail::digits10_2_2(digits10))));
|
||||
mpfr_init2(t, (std::max)(static_cast<unsigned>(std::numeric_limits<boost::ulong_long_type>::digits), static_cast<unsigned long>(multiprecision::detail::digits10_2_2(digits10))));
|
||||
mpfr_set_ui(m_data, 0, GMP_RNDN);
|
||||
while(i)
|
||||
{
|
||||
@@ -148,7 +148,7 @@ struct mpfr_float_imp<digits10, allocate_dynamic>
|
||||
mpfr_clear(t);
|
||||
return *this;
|
||||
}
|
||||
mpfr_float_imp& operator = (long long i)
|
||||
mpfr_float_imp& operator = (boost::long_long_type i)
|
||||
{
|
||||
if(m_data[0]._mpfr_d == 0)
|
||||
mpfr_init2(m_data, multiprecision::detail::digits10_2_2(digits10 ? digits10 : get_default_precision()));
|
||||
@@ -371,8 +371,8 @@ template <unsigned digits10>
|
||||
struct mpfr_float_imp<digits10, allocate_stack>
|
||||
{
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
typedef mpl::list<long, long long> signed_types;
|
||||
typedef mpl::list<unsigned long, unsigned long long> unsigned_types;
|
||||
typedef mpl::list<long, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<unsigned long, boost::ulong_long_type> unsigned_types;
|
||||
#else
|
||||
typedef mpl::list<long> signed_types;
|
||||
typedef mpl::list<unsigned long> unsigned_types;
|
||||
@@ -406,20 +406,20 @@ struct mpfr_float_imp<digits10, allocate_stack>
|
||||
}
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
#ifdef _MPFR_H_HAVE_INTMAX_T
|
||||
mpfr_float_imp& operator = (unsigned long long i)
|
||||
mpfr_float_imp& operator = (boost::ulong_long_type i)
|
||||
{
|
||||
mpfr_set_uj(m_data, i, GMP_RNDN);
|
||||
return *this;
|
||||
}
|
||||
mpfr_float_imp& operator = (long long i)
|
||||
mpfr_float_imp& operator = (boost::long_long_type i)
|
||||
{
|
||||
mpfr_set_sj(m_data, i, GMP_RNDN);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
mpfr_float_imp& operator = (unsigned long long i)
|
||||
mpfr_float_imp& operator = (boost::ulong_long_type i)
|
||||
{
|
||||
unsigned long long mask = (((1uLL << (std::numeric_limits<unsigned long>::digits - 1) - 1) << 1) | 1uL);
|
||||
boost::ulong_long_type mask = (((1uLL << (std::numeric_limits<unsigned long>::digits - 1) - 1) << 1) | 1uL);
|
||||
unsigned shift = 0;
|
||||
mpfr_t t;
|
||||
mp_limb_t t_limbs[limb_count];
|
||||
@@ -437,7 +437,7 @@ struct mpfr_float_imp<digits10, allocate_stack>
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
mpfr_float_imp& operator = (long long i)
|
||||
mpfr_float_imp& operator = (boost::long_long_type i)
|
||||
{
|
||||
bool neg = i < 0;
|
||||
*this = boost::multiprecision::detail::unsigned_abs(i);
|
||||
@@ -1206,7 +1206,7 @@ inline void eval_convert_to(long* result, const mpfr_float_backend<digits10, All
|
||||
}
|
||||
#ifdef _MPFR_H_HAVE_INTMAX_T
|
||||
template <unsigned digits10, mpfr_allocation_type AllocationType>
|
||||
inline void eval_convert_to(unsigned long long* result, const mpfr_float_backend<digits10, AllocationType>& val)
|
||||
inline void eval_convert_to(boost::ulong_long_type* result, const mpfr_float_backend<digits10, AllocationType>& val)
|
||||
{
|
||||
if(mpfr_nan_p(val.data()))
|
||||
{
|
||||
@@ -1215,7 +1215,7 @@ inline void eval_convert_to(unsigned long long* result, const mpfr_float_backend
|
||||
*result = mpfr_get_uj(val.data(), GMP_RNDZ);
|
||||
}
|
||||
template <unsigned digits10, mpfr_allocation_type AllocationType>
|
||||
inline void eval_convert_to(long long* result, const mpfr_float_backend<digits10, AllocationType>& val)
|
||||
inline void eval_convert_to(boost::long_long_type* result, const mpfr_float_backend<digits10, AllocationType>& val)
|
||||
{
|
||||
if(mpfr_nan_p(val.data()))
|
||||
{
|
||||
|
||||
@@ -38,8 +38,8 @@ void eval_add(tommath_int& t, const tommath_int& o);
|
||||
|
||||
struct tommath_int
|
||||
{
|
||||
typedef mpl::list<boost::int32_t, long long> signed_types;
|
||||
typedef mpl::list<boost::uint32_t, unsigned long long> unsigned_types;
|
||||
typedef mpl::list<boost::int32_t, boost::long_long_type> signed_types;
|
||||
typedef mpl::list<boost::uint32_t, boost::ulong_long_type> unsigned_types;
|
||||
typedef mpl::list<long double> float_types;
|
||||
|
||||
tommath_int()
|
||||
@@ -70,11 +70,11 @@ struct tommath_int
|
||||
detail::check_tommath_result(mp_copy(const_cast< ::mp_int*>(&o.m_data), &m_data));
|
||||
return *this;
|
||||
}
|
||||
tommath_int& operator = (unsigned long long i)
|
||||
tommath_int& operator = (boost::ulong_long_type i)
|
||||
{
|
||||
if(m_data.dp == 0)
|
||||
detail::check_tommath_result(mp_init(&m_data));
|
||||
unsigned long long mask = ((1uLL << std::numeric_limits<unsigned>::digits) - 1);
|
||||
boost::ulong_long_type mask = ((1uLL << std::numeric_limits<unsigned>::digits) - 1);
|
||||
unsigned shift = 0;
|
||||
::mp_int t;
|
||||
detail::check_tommath_result(mp_init(&t));
|
||||
@@ -91,7 +91,7 @@ struct tommath_int
|
||||
mp_clear(&t);
|
||||
return *this;
|
||||
}
|
||||
tommath_int& operator = (long long i)
|
||||
tommath_int& operator = (boost::long_long_type i)
|
||||
{
|
||||
if(m_data.dp == 0)
|
||||
detail::check_tommath_result(mp_init(&m_data));
|
||||
@@ -222,7 +222,7 @@ struct tommath_int
|
||||
unsigned shift = radix == 8 ? 3 : 4;
|
||||
unsigned block_count = DIGIT_BIT / shift;
|
||||
unsigned block_shift = shift * block_count;
|
||||
unsigned long long val, block;
|
||||
boost::ulong_long_type val, block;
|
||||
while(*s)
|
||||
{
|
||||
block = 0;
|
||||
@@ -536,7 +536,7 @@ inline void eval_complement(tommath_int& result, const tommath_int& u)
|
||||
|
||||
// Create a mask providing the extra bits we need and add to result:
|
||||
tommath_int mask;
|
||||
mask = static_cast<long long>((1u << padding) - 1);
|
||||
mask = static_cast<boost::long_long_type>((1u << padding) - 1);
|
||||
eval_left_shift(mask, shift);
|
||||
add(result, mask);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user