15 #ifndef IMPALA_RUNTIME_MULTI_PRECISION_H
16 #define IMPALA_RUNTIME_MULTI_PRECISION_H
21 #include <boost/version.hpp>
22 #if BOOST_VERSION < 105000
23 #define BOOST_NOEXCEPT
26 #define BOOST_NOEXCEPT_IF(Predicate)
27 #define BOOST_FORCEINLINE inline __attribute__ ((__always_inline__))
29 #define BOOST_NO_CXX11_CONSTEXPR
30 #define BOOST_NO_CXX11_DECLTYPE
31 #define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
32 #define BOOST_NO_CXX11_HDR_ARRAY
33 #define BOOST_NO_CXX11_RVALUE_REFERENCES
34 #define BOOST_NO_CXX11_USER_DEFINED_LITERALS
35 #define BOOST_NO_CXX11_VARIADIC_TEMPLATES
38 #include "boost_multiprecision/cpp_int.hpp"
39 #include "boost_multiprecision/cpp_dec_float.hpp"
42 #include <boost/multiprecision/cpp_int.hpp>
43 #include <boost/multiprecision/cpp_dec_float.hpp>
54 typedef boost::multiprecision::number<
55 boost::multiprecision::cpp_int_backend<256, 256,
56 boost::multiprecision::signed_magnitude,
57 boost::multiprecision::unchecked,
void> >
int256_t;
88 bool negative =
false;
96 uint64_t base = std::numeric_limits<int64_t>::max();
100 uint64_t v = (x % base).convert_to<uint64_t>();
102 *overflow |= (v > max_value / scale);
104 *overflow |= (result > max_value - n);
108 return negative ? -result : result;
120 return x & 0xffffffffffffffff;
int128_t abs(const int128_t &x)
int128_t ConvertToInt128(int256_t x, int128_t max_value, bool *overflow)
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void > > int256_t
Define 256 bit int type.
int256_t ConvertToInt256(const int128_t &x)
uint64_t LowBits(int128_t x)
uint64_t HighBits(int128_t x)
Get the high and low bits of an int128_t.
ostream & operator<<(ostream &os, const map< TNetworkAddress, llama::TAllocatedResource > &resources)
__int128_t int128_t
We use the c++ int128_t type. This is stored using 16 bytes and very performant.