198 changes: 99 additions & 99 deletions include/boost/multiprecision/cpp_dec_float.hpp

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions include/boost/multiprecision/cpp_int.hpp
Expand Up @@ -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
Expand All @@ -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":
//
Expand Down Expand Up @@ -1025,13 +1025,13 @@ struct cpp_int_backend
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_<
Expand Down
4 changes: 2 additions & 2 deletions include/boost/multiprecision/cpp_int/checked.hpp
Expand Up @@ -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)
{
Expand All @@ -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;
}
Expand Down
10 changes: 5 additions & 5 deletions include/boost/multiprecision/cpp_int/cpp_int_config.hpp
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions include/boost/multiprecision/detail/bitscan.hpp
Expand Up @@ -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);
}
Expand All @@ -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>
Expand All @@ -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
Expand All @@ -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
Expand Down
44 changes: 22 additions & 22 deletions include/boost/multiprecision/detail/default_ops.hpp
Expand Up @@ -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>
Expand Down Expand Up @@ -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<>());
}
Expand Down Expand Up @@ -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<>());
}
Expand Down Expand Up @@ -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;
Expand All @@ -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));
Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions include/boost/multiprecision/detail/generic_interconvert.hpp
Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions include/boost/multiprecision/detail/number_base.hpp
Expand Up @@ -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;
}
Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions include/boost/multiprecision/float128.hpp
Expand Up @@ -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;

Expand Down
53 changes: 28 additions & 25 deletions include/boost/multiprecision/gmp.hpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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()));
Expand All @@ -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;
Expand Down Expand Up @@ -858,23 +859,23 @@ 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);

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;
};

Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions include/boost/multiprecision/integer.hpp
Expand Up @@ -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,
Expand Down
20 changes: 10 additions & 10 deletions include/boost/multiprecision/mpfi.hpp
Expand Up @@ -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;
Expand Down Expand Up @@ -104,15 +104,15 @@ 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()));
mpfr_set_uj(left_data(), i, GMP_RNDD);
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()));
Expand All @@ -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)
{
Expand All @@ -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()));
Expand Down Expand Up @@ -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());
Expand Down
34 changes: 17 additions & 17 deletions include/boost/multiprecision/mpfr.hpp
Expand Up @@ -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;
Expand Down Expand Up @@ -112,29 +112,29 @@ 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()));
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)
{
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)
{
Expand All @@ -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()));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand All @@ -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);
Expand Down Expand Up @@ -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()))
{
Expand All @@ -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()))
{
Expand Down
14 changes: 7 additions & 7 deletions include/boost/multiprecision/tommath.hpp
Expand Up @@ -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()
Expand Down Expand Up @@ -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));
Expand All @@ -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));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down