diff --git a/include/boost/multiprecision/concepts/mp_number_archetypes.hpp b/include/boost/multiprecision/concepts/mp_number_archetypes.hpp index e52044ad..5d5d8417 100644 --- a/include/boost/multiprecision/concepts/mp_number_archetypes.hpp +++ b/include/boost/multiprecision/concepts/mp_number_archetypes.hpp @@ -26,8 +26,8 @@ namespace concepts{ struct number_backend_float_architype { - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef mpl::list signed_types; + typedef mpl::list unsigned_types; typedef mpl::list 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(val.m_value); + *result = static_cast(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(val.m_value); + *result = static_cast(val.m_value); } inline void eval_convert_to(long double* result, number_backend_float_architype& val) { diff --git a/include/boost/multiprecision/cpp_bin_float.hpp b/include/boost/multiprecision/cpp_bin_float.hpp index 9a4ceff5..1b11c782 100644 --- a/include/boost/multiprecision/cpp_bin_float.hpp +++ b/include/boost/multiprecision/cpp_bin_float.hpp @@ -1045,7 +1045,7 @@ inline bool eval_eq(const cpp_bin_float -inline void eval_convert_to(long long *res, const cpp_bin_float &arg) +inline void eval_convert_to(boost::long_long_type *res, const cpp_bin_float &arg) { switch(arg.exponent()) { @@ -1055,7 +1055,7 @@ inline void eval_convert_to(long long *res, const cpp_bin_float::exponent_nan: BOOST_THROW_EXCEPTION(std::runtime_error("Could not convert NaN to integer.")); case cpp_bin_float::exponent_infinity: - *res = (std::numeric_limits::max)(); + *res = (std::numeric_limits::max)(); if(arg.sign()) *res = -*res; return; @@ -1068,14 +1068,14 @@ inline void eval_convert_to(long long *res, const cpp_bin_float::min)()) <= 0)) + if(arg.sign() && (arg.compare((std::numeric_limits::min)()) <= 0)) { - *res = (std::numeric_limits::min)(); + *res = (std::numeric_limits::min)(); return; } - else if(!arg.sign() && (arg.compare((std::numeric_limits::max)()) >= 0)) + else if(!arg.sign() && (arg.compare((std::numeric_limits::max)()) >= 0)) { - *res = (std::numeric_limits::max)(); + *res = (std::numeric_limits::max)(); return; } eval_right_shift(man, shift); @@ -1087,7 +1087,7 @@ inline void eval_convert_to(long long *res, const cpp_bin_float -inline void eval_convert_to(unsigned long long *res, const cpp_bin_float &arg) +inline void eval_convert_to(boost::ulong_long_type *res, const cpp_bin_float &arg) { switch(arg.exponent()) { @@ -1097,7 +1097,7 @@ inline void eval_convert_to(unsigned long long *res, const cpp_bin_float::exponent_nan: BOOST_THROW_EXCEPTION(std::runtime_error("Could not convert NaN to integer.")); case cpp_bin_float::exponent_infinity: - *res = (std::numeric_limits::max)(); + *res = (std::numeric_limits::max)(); return; } typename cpp_bin_float::rep_type man(arg.bits()); @@ -1110,8 +1110,8 @@ inline void eval_convert_to(unsigned long long *res, const cpp_bin_float::bit_count than a long long? - *res = (std::numeric_limits::max)(); + // TODO: what if we have fewer cpp_bin_float::bit_count than a boost::long_long_type? + *res = (std::numeric_limits::max)(); return; } eval_right_shift(man, shift); diff --git a/include/boost/multiprecision/cpp_dec_float.hpp b/include/boost/multiprecision/cpp_dec_float.hpp index d19abafe..ba0800bb 100644 --- a/include/boost/multiprecision/cpp_dec_float.hpp +++ b/include/boost/multiprecision/cpp_dec_float.hpp @@ -59,8 +59,8 @@ private: BOOST_STATIC_ASSERT_MSG(sizeof(ExponentType) > 1, "ExponentType is too small."); public: - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef mpl::list signed_types; + typedef mpl::list unsigned_types; typedef mpl::list 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(0u)); + static cpp_dec_float val(static_cast(0u)); return val; } static const cpp_dec_float& one() { init.do_nothing(); - static cpp_dec_float val(static_cast(1u)); + static cpp_dec_float val(static_cast(1u)); return val; } static const cpp_dec_float& two() { init.do_nothing(); - static cpp_dec_float val(static_cast(2u)); + static cpp_dec_float val(static_cast(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::max)()); + static cpp_dec_float val((std::numeric_limits::max)()); return val; } static const cpp_dec_float& long_long_min() { init.do_nothing(); - static cpp_dec_float val((std::numeric_limits::min)()); + static cpp_dec_float val((std::numeric_limits::min)()); return val; } static const cpp_dec_float& ulong_long_max() { init.do_nothing(); - static cpp_dec_float val((std::numeric_limits::max)()); + static cpp_dec_float val((std::numeric_limits::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(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(0u))); @@ -590,7 +590,7 @@ private: static bool data_elem_is_non_nine_predicate(const boost::uint32_t& d) { return (d != static_cast(cpp_dec_float::cpp_dec_float_elem_mask - 1)); } static bool char_is_nonzero_predicate(const char& c) { return (c != static_cast('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& cpp_dec_float -cpp_dec_float& cpp_dec_float::mul_unsigned_long_long(const unsigned long long n) +cpp_dec_float& cpp_dec_float::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& cpp_dec_float= static_cast(cpp_dec_float_elem_mask)) + if(n >= static_cast(cpp_dec_float_elem_mask)) { neg = b_neg; cpp_dec_float t; @@ -1011,7 +1011,7 @@ cpp_dec_float& cpp_dec_float(1u)) + if(n == static_cast(1u)) { neg = b_neg; return *this; @@ -1050,9 +1050,9 @@ cpp_dec_float& cpp_dec_float -cpp_dec_float& cpp_dec_float::div_unsigned_long_long(const unsigned long long n) +cpp_dec_float& cpp_dec_float::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& cpp_dec_float(0u)) + if(n == static_cast(0u)) { // Divide by 0. if(iszero()) @@ -1096,7 +1096,7 @@ cpp_dec_float& cpp_dec_float= static_cast(cpp_dec_float_elem_mask)) + if(n >= static_cast(cpp_dec_float_elem_mask)) { neg = b_neg; cpp_dec_float t; @@ -1584,58 +1584,58 @@ long double cpp_dec_float::extract_long_doubl } template -signed long long cpp_dec_float::extract_signed_long_long() const +boost::long_long_type cpp_dec_float::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(0)) { - return static_cast(0); + return static_cast(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::max)(); + return (std::numeric_limits::max)(); } else if(b_neg && (compare(long_long_min()) < 0)) { - return (std::numeric_limits::min)(); + return (std::numeric_limits::min)(); } else { - // Extract the data into an unsigned long long value. + // Extract the data into an boost::ulong_long_type value. cpp_dec_float xn(extract_integer_part()); if(xn.isneg()) xn.negate(); - val = static_cast(xn.data[0]); + val = static_cast(xn.data[0]); const boost::int32_t imax = (std::min)(static_cast(static_cast(xn.exp) / cpp_dec_float_elem_digits10), static_cast(cpp_dec_float_elem_number - static_cast(1))); for(boost::int32_t i = static_cast(1); i <= imax; i++) { - val *= static_cast(cpp_dec_float_elem_mask); - val += static_cast(xn.data[i]); + val *= static_cast(cpp_dec_float_elem_mask); + val += static_cast(xn.data[i]); } } if (!b_neg) { - return static_cast(val); + return static_cast(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(val - 1); + boost::long_long_type sval = static_cast(val - 1); sval = -sval; --sval; return sval; @@ -1643,43 +1643,43 @@ signed long long cpp_dec_float::extract_signe } template -unsigned long long cpp_dec_float::extract_unsigned_long_long() const +boost::ulong_long_type cpp_dec_float::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(extract_signed_long_long()); + return static_cast(extract_signed_long_long()); } if(exp < static_cast(0)) { - return static_cast(0u); + return static_cast(0u); } const cpp_dec_float xn(extract_integer_part()); - unsigned long long val; + boost::ulong_long_type val; if(xn.compare(ulong_long_max()) > 0) { - return (std::numeric_limits::max)(); + return (std::numeric_limits::max)(); } else { - // Extract the data into an unsigned long long value. - val = static_cast(xn.data[0]); + // Extract the data into an boost::ulong_long_type value. + val = static_cast(xn.data[0]); const boost::int32_t imax = (std::min)(static_cast(static_cast(xn.exp) / cpp_dec_float_elem_digits10), static_cast(cpp_dec_float_elem_number - static_cast(1))); for(boost::int32_t i = static_cast(1); i <= imax; i++) { - val *= static_cast(cpp_dec_float_elem_mask); - val += static_cast(xn.data[i]); + val *= static_cast(cpp_dec_float_elem_mask); + val += static_cast(xn.data[i]); } } @@ -2209,8 +2209,8 @@ cpp_dec_float::cpp_dec_float(const double man template cpp_dec_float& cpp_dec_float::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& cpp_dec_float -void cpp_dec_float::from_unsigned_long_long(const unsigned long long u) +void cpp_dec_float::from_unsigned_long_long(const boost::ulong_long_type u) { std::fill(data.begin(), data.end(), static_cast(0u)); @@ -2270,14 +2270,14 @@ void cpp_dec_float::from_unsigned_long_long(c std::size_t i =static_cast(0u); - unsigned long long uu = u; + boost::ulong_long_type uu = u; - boost::uint32_t temp[(std::numeric_limits::digits10 / static_cast(cpp_dec_float_elem_digits10)) + 3] = { static_cast(0u) }; + boost::uint32_t temp[(std::numeric_limits::digits10 / static_cast(cpp_dec_float_elem_digits10)) + 3] = { static_cast(0u) }; - while(uu != static_cast(0u)) + while(uu != static_cast(0u)) { - temp[i] = static_cast(uu % static_cast(cpp_dec_float_elem_mask)); - uu = static_cast(uu / static_cast(cpp_dec_float_elem_mask)); + temp[i] = static_cast(uu % static_cast(cpp_dec_float_elem_mask)); + uu = static_cast(uu / static_cast(cpp_dec_float_elem_mask)); ++i; } @@ -2351,7 +2351,7 @@ boost::uint32_t cpp_dec_float::div_loop_n(boo } template -cpp_dec_float cpp_dec_float::pow2(const long long p) +cpp_dec_float cpp_dec_float::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 cpp_dec_float(4)), - cpp_dec_float(static_cast(8)), - cpp_dec_float(static_cast(16)), - cpp_dec_float(static_cast(32)), - cpp_dec_float(static_cast(64)), - cpp_dec_float(static_cast(128)), - cpp_dec_float(static_cast(256)), - cpp_dec_float(static_cast(512)), - cpp_dec_float(static_cast(1024)), - cpp_dec_float(static_cast(2048)), - cpp_dec_float(static_cast(4096)), - cpp_dec_float(static_cast(8192)), - cpp_dec_float(static_cast(16384)), - cpp_dec_float(static_cast(32768)), - cpp_dec_float(static_cast(65536)), - cpp_dec_float(static_cast(131072)), - cpp_dec_float(static_cast(262144)), - cpp_dec_float(static_cast(524288)), + cpp_dec_float(static_cast(4)), + cpp_dec_float(static_cast(8)), + cpp_dec_float(static_cast(16)), + cpp_dec_float(static_cast(32)), + cpp_dec_float(static_cast(64)), + cpp_dec_float(static_cast(128)), + cpp_dec_float(static_cast(256)), + cpp_dec_float(static_cast(512)), + cpp_dec_float(static_cast(1024)), + cpp_dec_float(static_cast(2048)), + cpp_dec_float(static_cast(4096)), + cpp_dec_float(static_cast(8192)), + cpp_dec_float(static_cast(16384)), + cpp_dec_float(static_cast(32768)), + cpp_dec_float(static_cast(65536)), + cpp_dec_float(static_cast(131072)), + cpp_dec_float(static_cast(262144)), + cpp_dec_float(static_cast(524288)), cpp_dec_float(static_cast(1uL << 20u)), cpp_dec_float(static_cast(1uL << 21u)), cpp_dec_float(static_cast(1uL << 22u)), @@ -2616,16 +2616,16 @@ cpp_dec_float cpp_dec_float static_cast(-128)) && (p < static_cast(+128))) + if((p > static_cast(-128)) && (p < static_cast(+128))) { return p2_data[static_cast(p + ((p2_data.size() - 1u) / 2u))]; } else { // Compute and return 2^p. - if(p < static_cast(0)) + if(p < static_cast(0)) { - return pow2(static_cast(-p)).calculate_inv(); + return pow2(static_cast(-p)).calculate_inv(); } else { @@ -2659,28 +2659,28 @@ inline void eval_divide(cpp_dec_float& result } template -inline void eval_add(cpp_dec_float& result, const unsigned long long& o) +inline void eval_add(cpp_dec_float& result, const boost::ulong_long_type& o) { result.add_unsigned_long_long(o); } template -inline void eval_subtract(cpp_dec_float& result, const unsigned long long& o) +inline void eval_subtract(cpp_dec_float& result, const boost::ulong_long_type& o) { result.sub_unsigned_long_long(o); } template -inline void eval_multiply(cpp_dec_float& result, const unsigned long long& o) +inline void eval_multiply(cpp_dec_float& result, const boost::ulong_long_type& o) { result.mul_unsigned_long_long(o); } template -inline void eval_divide(cpp_dec_float& result, const unsigned long long& o) +inline void eval_divide(cpp_dec_float& result, const boost::ulong_long_type& o) { result.div_unsigned_long_long(o); } template -inline void eval_add(cpp_dec_float& result, long long o) +inline void eval_add(cpp_dec_float& 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& result, l result.add_unsigned_long_long(o); } template -inline void eval_subtract(cpp_dec_float& result, long long o) +inline void eval_subtract(cpp_dec_float& 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& resu result.sub_unsigned_long_long(o); } template -inline void eval_multiply(cpp_dec_float& result, long long o) +inline void eval_multiply(cpp_dec_float& result, boost::long_long_type o) { if(o < 0) { @@ -2707,7 +2707,7 @@ inline void eval_multiply(cpp_dec_float& resu result.mul_unsigned_long_long(o); } template -inline void eval_divide(cpp_dec_float& result, long long o) +inline void eval_divide(cpp_dec_float& result, boost::long_long_type o) { if(o < 0) { @@ -2719,12 +2719,12 @@ inline void eval_divide(cpp_dec_float& result } template -inline void eval_convert_to(unsigned long long* result, const cpp_dec_float& val) +inline void eval_convert_to(boost::ulong_long_type* result, const cpp_dec_float& val) { *result = val.extract_unsigned_long_long(); } template -inline void eval_convert_to(long long* result, const cpp_dec_float& val) +inline void eval_convert_to(boost::long_long_type* result, const cpp_dec_float& val) { *result = val.extract_signed_long_long(); } @@ -2834,18 +2834,18 @@ inline void eval_scalbn(cpp_dec_float& result template inline void eval_ldexp(cpp_dec_float& result, const cpp_dec_float& x, ArgType e) { - const long long the_exp = static_cast(e); + const boost::long_long_type the_exp = static_cast(e); if((the_exp > (std::numeric_limits::max)()) || (the_exp < (std::numeric_limits::min)())) BOOST_THROW_EXCEPTION(std::runtime_error(std::string("Exponent value is out of range."))); result = x; - if ((the_exp > static_cast(-std::numeric_limits::digits)) && (the_exp < static_cast(0))) - result.div_unsigned_long_long(1ULL << static_cast(-the_exp)); - else if((the_exp < static_cast( std::numeric_limits::digits)) && (the_exp > static_cast(0))) + if ((the_exp > static_cast(-std::numeric_limits::digits)) && (the_exp < static_cast(0))) + result.div_unsigned_long_long(1ULL << static_cast(-the_exp)); + else if((the_exp < static_cast( std::numeric_limits::digits)) && (the_exp > static_cast(0))) result.mul_unsigned_long_long(1ULL << the_exp); - else if(the_exp != static_cast(0)) + else if(the_exp != static_cast(0)) result *= cpp_dec_float::pow2(e); } diff --git a/include/boost/multiprecision/cpp_int.hpp b/include/boost/multiprecision/cpp_int.hpp index 311f7c16..26fee765 100644 --- a/include/boost/multiprecision/cpp_int.hpp +++ b/include/boost/multiprecision/cpp_int.hpp @@ -689,7 +689,7 @@ const bool cpp_int_base 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 struct trivial_limb_type_imp @@ -704,7 +704,7 @@ struct trivial_limb_type_imp }; template -struct trivial_limb_type : public trivial_limb_type_imp {}; +struct trivial_limb_type : public trivial_limb_type_imp {}; // // 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 >::type signed_types; typedef typename mpl::if_< trivial_tag, mpl::list, + unsigned long, boost::ulong_long_type, double_limb_type>, mpl::list >::type unsigned_types; typedef typename mpl::if_< diff --git a/include/boost/multiprecision/cpp_int/checked.hpp b/include/boost/multiprecision/cpp_int/checked.hpp index bf3bc650..cafe50ea 100644 --- a/include/boost/multiprecision/cpp_int/checked.hpp +++ b/include/boost/multiprecision/cpp_int/checked.hpp @@ -128,7 +128,7 @@ inline A checked_divide(A a, A b, const mpl::int_&) } template -inline A checked_left_shift(A a, unsigned long long shift, const mpl::int_&) +inline A checked_left_shift(A a, boost::ulong_long_type shift, const mpl::int_&) { if(a && shift) { @@ -138,7 +138,7 @@ inline A checked_left_shift(A a, unsigned long long shift, const mpl::int_ -inline A checked_left_shift(A a, unsigned long long shift, const mpl::int_&) +inline A checked_left_shift(A a, boost::ulong_long_type shift, const mpl::int_&) { return (shift >= sizeof(A) * CHAR_BIT) ? 0 : a << shift; } diff --git a/include/boost/multiprecision/cpp_int/cpp_int_config.hpp b/include/boost/multiprecision/cpp_int/cpp_int_config.hpp index 0b8b33d3..eb88f3da 100644 --- a/include/boost/multiprecision/cpp_int/cpp_int_config.hpp +++ b/include/boost/multiprecision/cpp_int/cpp_int_config.hpp @@ -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 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 struct largest_signed_type { typedef typename mpl::if_c< - 1 + std::numeric_limits::digits == N, - long long, + 1 + std::numeric_limits::digits == N, + boost::long_long_type, typename mpl::if_c< 1 + std::numeric_limits::digits == N, long, @@ -47,8 +47,8 @@ template struct largest_unsigned_type { typedef typename mpl::if_c< - std::numeric_limits::digits == N, - unsigned long long, + std::numeric_limits::digits == N, + boost::ulong_long_type, typename mpl::if_c< std::numeric_limits::digits == N, unsigned long, diff --git a/include/boost/multiprecision/detail/bitscan.hpp b/include/boost/multiprecision/detail/bitscan.hpp index 40602a93..ce1cdc8d 100644 --- a/include/boost/multiprecision/detail/bitscan.hpp +++ b/include/boost/multiprecision/detail/bitscan.hpp @@ -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 @@ -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 diff --git a/include/boost/multiprecision/detail/default_ops.hpp b/include/boost/multiprecision/detail/default_ops.hpp index bf51a582..01fbe181 100644 --- a/include/boost/multiprecision/detail/default_ops.hpp +++ b/include/boost/multiprecision/detail/default_ops.hpp @@ -1219,7 +1219,7 @@ inline typename B::exponent_type eval_ilogb(const B& val) template inline void eval_logb(B& result, const B& val) { - typedef typename boost::mpl::if_c::value, long long, boost::intmax_t>::type max_t; + typedef typename boost::mpl::if_c::value, boost::long_long_type, boost::intmax_t>::type max_t; result = static_cast(eval_ilogb(val)); } template @@ -1436,29 +1436,29 @@ inline long ltrunc(const number& v) } #ifndef BOOST_NO_LONG_LONG template -inline long long lltrunc(const detail::expression& v, const Policy& pol) +inline boost::long_long_type lltrunc(const detail::expression& v, const Policy& pol) { typedef typename detail::expression::result_type number_type; number_type r = trunc(v, pol); - if((r > (std::numeric_limits::max)()) || r < (std::numeric_limits::min)() || !(boost::math::isfinite)(v)) + if((r > (std::numeric_limits::max)()) || r < (std::numeric_limits::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(); + return r.template convert_to(); } template -inline long long lltrunc(const detail::expression& v) +inline boost::long_long_type lltrunc(const detail::expression& v) { return lltrunc(v, boost::math::policies::policy<>()); } template -inline long long lltrunc(const number& v, const Policy& pol) +inline boost::long_long_type lltrunc(const number& v, const Policy& pol) { number r = trunc(v, pol); - if((r > (std::numeric_limits::max)()) || r < (std::numeric_limits::min)() || !(boost::math::isfinite)(v)) + if((r > (std::numeric_limits::max)()) || r < (std::numeric_limits::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(); + return r.template convert_to(); } template -inline long long lltrunc(const number& v) +inline boost::long_long_type lltrunc(const number& v) { return lltrunc(v, boost::math::policies::policy<>()); } @@ -1534,29 +1534,29 @@ inline long lround(const number& v) } #ifndef BOOST_NO_LONG_LONG template -inline long long llround(const detail::expression& v, const Policy& pol) +inline boost::long_long_type llround(const detail::expression& v, const Policy& pol) { typedef typename detail::expression::result_type number_type; number_type r = round(v, pol); - if((r > (std::numeric_limits::max)()) || r < (std::numeric_limits::min)() || !(boost::math::isfinite)(v)) + if((r > (std::numeric_limits::max)()) || r < (std::numeric_limits::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(); + return r.template convert_to(); } template -inline long long llround(const detail::expression& v) +inline boost::long_long_type llround(const detail::expression& v) { return llround(v, boost::math::policies::policy<>()); } template -inline long long llround(const number& v, const Policy& pol) +inline boost::long_long_type llround(const number& v, const Policy& pol) { number r = round(v, pol); - if((r > (std::numeric_limits::max)()) || r < (std::numeric_limits::min)() || !(boost::math::isfinite)(v)) + if((r > (std::numeric_limits::max)()) || r < (std::numeric_limits::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(); + return r.template convert_to(); } template -inline long long llround(const number& v) +inline boost::long_long_type llround(const number& v) { return llround(v, boost::math::policies::policy<>()); } @@ -1612,7 +1612,7 @@ frexp(const detail::expression& v, long* pint) return BOOST_MP_MOVE(frexp(static_cast(v), pint)); } template -inline typename enable_if_c::value == number_kind_floating_point, number >::type frexp(const number& v, long long* pint) +inline typename enable_if_c::value == number_kind_floating_point, number >::type frexp(const number& v, boost::long_long_type* pint) { using default_ops::eval_frexp; number result; @@ -1621,7 +1621,7 @@ inline typename enable_if_c::value == number_kind_floating_po } template inline typename enable_if_c::result_type>::value == number_kind_floating_point, typename detail::expression::result_type>::type -frexp(const detail::expression& v, long long* pint) +frexp(const detail::expression& v, boost::long_long_type* pint) { typedef typename detail::expression::result_type number_type; return BOOST_MP_MOVE(frexp(static_cast(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: diff --git a/include/boost/multiprecision/detail/generic_interconvert.hpp b/include/boost/multiprecision/detail/generic_interconvert.hpp index 690723be..b261d81e 100644 --- a/include/boost/multiprecision/detail/generic_interconvert.hpp +++ b/include/boost/multiprecision/detail/generic_interconvert.hpp @@ -392,7 +392,7 @@ template void generic_interconvert_float2rational(To& to, const From& from, const mpl::int_<2>& /*radix*/) { typedef typename mpl::front::type ui_type; - static const int shift = std::numeric_limits::digits; + static const int shift = std::numeric_limits::digits; typename From::exponent_type e; typename component_type >::type num, denom; number 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; diff --git a/include/boost/multiprecision/detail/number_base.hpp b/include/boost/multiprecision/detail/number_base.hpp index 321e356f..ca1e4021 100644 --- a/include/boost/multiprecision/detail/number_base.hpp +++ b/include/boost/multiprecision/detail/number_base.hpp @@ -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 BOOST_CONSTEXPR typename enable_if_c<(is_signed::value || is_floating_point::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 BOOST_CONSTEXPR typename enable_if_c<(is_signed::value || is_floating_point::value), typename make_unsigned::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::type>(1u) + static_cast::type>(-(t + 1)) : static_cast::type>(t); } diff --git a/include/boost/multiprecision/float128.hpp b/include/boost/multiprecision/float128.hpp index 6e2958e0..d736f8ae 100644 --- a/include/boost/multiprecision/float128.hpp +++ b/include/boost/multiprecision/float128.hpp @@ -127,9 +127,9 @@ namespace backends{ struct float128_backend { - typedef mpl::list signed_types; + typedef mpl::list signed_types; typedef mpl::list unsigned_types; + unsigned int, unsigned long, boost::ulong_long_type> unsigned_types; typedef mpl::list float_types; typedef int exponent_type; diff --git a/include/boost/multiprecision/gmp.hpp b/include/boost/multiprecision/gmp.hpp index 0ab8346a..097c298e 100644 --- a/include/boost/multiprecision/gmp.hpp +++ b/include/boost/multiprecision/gmp.hpp @@ -60,8 +60,8 @@ template struct gmp_float_imp { #ifdef BOOST_HAS_LONG_LONG - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef mpl::list signed_types; + typedef mpl::list unsigned_types; #else typedef mpl::list signed_types; typedef mpl::list 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(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::digits - 1)) - 1) << 1) | 1uLL); + boost::ulong_long_type mask = ((((1uLL << (std::numeric_limits::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(boost::multiprecision::detail::unsigned_abs(i)); + *this = static_cast(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& val) BOOS } #ifdef BOOST_HAS_LONG_LONG template -inline void eval_convert_to(long long* result, const gmp_float& val) +inline void eval_convert_to(boost::long_long_type* result, const gmp_float& val) { gmp_float t(val); if(eval_get_sign(t) < 0) t.negate(); - long digits = std::numeric_limits::digits - std::numeric_limits::digits; + long digits = std::numeric_limits::digits - std::numeric_limits::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& val) if(!mpf_fits_slong_p(t.data())) { if(eval_get_sign(val) < 0) - *result = (std::numeric_limits::min)(); + *result = (std::numeric_limits::min)(); else - *result = (std::numeric_limits::max)(); + *result = (std::numeric_limits::max)(); return; }; @@ -893,18 +894,18 @@ inline void eval_convert_to(long long* result, const gmp_float& val) *result = -*result; } template -inline void eval_convert_to(unsigned long long* result, const gmp_float& val) +inline void eval_convert_to(boost::ulong_long_type* result, const gmp_float& val) { gmp_float t(val); - long digits = std::numeric_limits::digits - std::numeric_limits::digits; + long digits = std::numeric_limits::digits - std::numeric_limits::digits; if(digits > 0) mpf_div_2exp(t.data(), t.data(), digits); if(!mpf_fits_ulong_p(t.data())) { - *result = (std::numeric_limits::max)(); + *result = (std::numeric_limits::max)(); return; } @@ -985,8 +986,8 @@ inline void eval_frexp(gmp_float& result, const gmp_float& v struct gmp_int { #ifdef BOOST_HAS_LONG_LONG - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef mpl::list signed_types; + typedef mpl::list unsigned_types; #else typedef mpl::list signed_types; typedef mpl::list 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(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::digits - 1)) - 1) << 1) | 1uLL); + boost::ulong_long_type mask = ((((1uLL << (std::numeric_limits::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 signed_types; - typedef mpl::list unsigned_types; + typedef mpl::list signed_types; + typedef mpl::list unsigned_types; #else typedef mpl::list signed_types; typedef mpl::list 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(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); diff --git a/include/boost/multiprecision/integer.hpp b/include/boost/multiprecision/integer.hpp index 4432f1e9..e4c8bf8b 100644 --- a/include/boost/multiprecision/integer.hpp +++ b/include/boost/multiprecision/integer.hpp @@ -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 struct double_integer { static const unsigned int_t_digits = - 2 * sizeof(I) <= sizeof(long long) ? std::numeric_limits::digits * 2 : 1; + 2 * sizeof(I) <= sizeof(boost::long_long_type) ? std::numeric_limits::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::value, typename boost::int_t::least, diff --git a/include/boost/multiprecision/mpfi.hpp b/include/boost/multiprecision/mpfi.hpp index 68b77797..7dc2b9d7 100644 --- a/include/boost/multiprecision/mpfi.hpp +++ b/include/boost/multiprecision/mpfi.hpp @@ -56,8 +56,8 @@ template struct mpfi_float_imp { #ifdef BOOST_HAS_LONG_LONG - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef mpl::list signed_types; + typedef mpl::list unsigned_types; #else typedef mpl::list signed_types; typedef mpl::list 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::digits - 1) - 1) << 1) | 1u); + boost::ulong_long_type mask = (((1uLL << (std::numeric_limits::digits - 1) - 1) << 1) | 1u); unsigned shift = 0; mpfi_t t; - mpfi_init2(t, (std::max)(static_cast(std::numeric_limits::digits), static_cast(multiprecision::detail::digits10_2_2(digits10)))); + mpfi_init2(t, (std::max)(static_cast(std::numeric_limits::digits), static_cast(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& va } #ifdef _MPFR_H_HAVE_INTMAX_T template -inline void eval_convert_to(unsigned long long* result, const mpfi_float_backend& val) +inline void eval_convert_to(boost::ulong_long_type* result, const mpfi_float_backend& val) { mpfr_float_backend t; mpfi_mid(t.data(), val.data()); eval_convert_to(result, t); } template -inline void eval_convert_to(long long* result, const mpfi_float_backend& val) +inline void eval_convert_to(boost::long_long_type* result, const mpfi_float_backend& val) { mpfr_float_backend t; mpfi_mid(t.data(), val.data()); diff --git a/include/boost/multiprecision/mpfr.hpp b/include/boost/multiprecision/mpfr.hpp index d9327e28..02e13a02 100644 --- a/include/boost/multiprecision/mpfr.hpp +++ b/include/boost/multiprecision/mpfr.hpp @@ -64,8 +64,8 @@ template struct mpfr_float_imp { #ifdef BOOST_HAS_LONG_LONG - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef mpl::list signed_types; + typedef mpl::list unsigned_types; #else typedef mpl::list signed_types; typedef mpl::list unsigned_types; @@ -112,14 +112,14 @@ struct mpfr_float_imp #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 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::digits - 1) - 1) << 1) | 1uLL); + boost::ulong_long_type mask = (((1uLL << (std::numeric_limits::digits - 1) - 1) << 1) | 1uLL); unsigned shift = 0; mpfr_t t; - mpfr_init2(t, (std::max)(static_cast(std::numeric_limits::digits), static_cast(multiprecision::detail::digits10_2_2(digits10)))); + mpfr_init2(t, (std::max)(static_cast(std::numeric_limits::digits), static_cast(multiprecision::detail::digits10_2_2(digits10)))); mpfr_set_ui(m_data, 0, GMP_RNDN); while(i) { @@ -148,7 +148,7 @@ struct mpfr_float_imp 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 struct mpfr_float_imp { #ifdef BOOST_HAS_LONG_LONG - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef mpl::list signed_types; + typedef mpl::list unsigned_types; #else typedef mpl::list signed_types; typedef mpl::list unsigned_types; @@ -406,20 +406,20 @@ struct mpfr_float_imp } #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::digits - 1) - 1) << 1) | 1uL); + boost::ulong_long_type mask = (((1uLL << (std::numeric_limits::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 } 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 -inline void eval_convert_to(unsigned long long* result, const mpfr_float_backend& val) +inline void eval_convert_to(boost::ulong_long_type* result, const mpfr_float_backend& 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 -inline void eval_convert_to(long long* result, const mpfr_float_backend& val) +inline void eval_convert_to(boost::long_long_type* result, const mpfr_float_backend& val) { if(mpfr_nan_p(val.data())) { diff --git a/include/boost/multiprecision/tommath.hpp b/include/boost/multiprecision/tommath.hpp index 8abee83c..90b1b788 100644 --- a/include/boost/multiprecision/tommath.hpp +++ b/include/boost/multiprecision/tommath.hpp @@ -38,8 +38,8 @@ void eval_add(tommath_int& t, const tommath_int& o); struct tommath_int { - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef mpl::list signed_types; + typedef mpl::list unsigned_types; typedef mpl::list 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::digits) - 1); + boost::ulong_long_type mask = ((1uLL << std::numeric_limits::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((1u << padding) - 1); + mask = static_cast((1u << padding) - 1); eval_left_shift(mask, shift); add(result, mask); }