mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Another 256-bit integers (strict 32 bytes) (#14229)
This commit is contained in:
parent
f8aa6cfe8a
commit
7c20aa2c62
@ -38,18 +38,18 @@ namespace common
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline bool addOverflow(bInt256 x, bInt256 y, bInt256 & res)
|
inline bool addOverflow(wInt256 x, wInt256 y, wInt256 & res)
|
||||||
{
|
{
|
||||||
res = x + y;
|
res = x + y;
|
||||||
return (y > 0 && x > std::numeric_limits<bInt256>::max() - y) ||
|
return (y > 0 && x > std::numeric_limits<wInt256>::max() - y) ||
|
||||||
(y < 0 && x < std::numeric_limits<bInt256>::min() - y);
|
(y < 0 && x < std::numeric_limits<wInt256>::min() - y);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline bool addOverflow(bUInt256 x, bUInt256 y, bUInt256 & res)
|
inline bool addOverflow(wUInt256 x, wUInt256 y, wUInt256 & res)
|
||||||
{
|
{
|
||||||
res = x + y;
|
res = x + y;
|
||||||
return x > std::numeric_limits<bUInt256>::max() - y;
|
return x > std::numeric_limits<wUInt256>::max() - y;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -86,15 +86,15 @@ namespace common
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline bool subOverflow(bInt256 x, bInt256 y, bInt256 & res)
|
inline bool subOverflow(wInt256 x, wInt256 y, wInt256 & res)
|
||||||
{
|
{
|
||||||
res = x - y;
|
res = x - y;
|
||||||
return (y < 0 && x > std::numeric_limits<bInt256>::max() + y) ||
|
return (y < 0 && x > std::numeric_limits<wInt256>::max() + y) ||
|
||||||
(y > 0 && x < std::numeric_limits<bInt256>::min() + y);
|
(y > 0 && x < std::numeric_limits<wInt256>::min() + y);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline bool subOverflow(bUInt256 x, bUInt256 y, bUInt256 & res)
|
inline bool subOverflow(wUInt256 x, wUInt256 y, wUInt256 & res)
|
||||||
{
|
{
|
||||||
res = x - y;
|
res = x - y;
|
||||||
return x < y;
|
return x < y;
|
||||||
@ -137,19 +137,19 @@ namespace common
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline bool mulOverflow(bInt256 x, bInt256 y, bInt256 & res)
|
inline bool mulOverflow(wInt256 x, wInt256 y, wInt256 & res)
|
||||||
{
|
{
|
||||||
res = x * y;
|
res = x * y;
|
||||||
if (!x || !y)
|
if (!x || !y)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bInt256 a = (x > 0) ? x : -x;
|
wInt256 a = (x > 0) ? x : -x;
|
||||||
bInt256 b = (y > 0) ? y : -y;
|
wInt256 b = (y > 0) ? y : -y;
|
||||||
return (a * b) / b != a;
|
return (a * b) / b != a;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline bool mulOverflow(bUInt256 x, bUInt256 y, bUInt256 & res)
|
inline bool mulOverflow(wUInt256 x, wUInt256 y, wUInt256 & res)
|
||||||
{
|
{
|
||||||
res = x * y;
|
res = x * y;
|
||||||
if (!x || !y)
|
if (!x || !y)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#include <boost/multiprecision/cpp_int.hpp>
|
#include <common/wide_integer.h>
|
||||||
|
|
||||||
using Int8 = int8_t;
|
using Int8 = int8_t;
|
||||||
using Int16 = int16_t;
|
using Int16 = int16_t;
|
||||||
@ -25,12 +25,11 @@ using UInt64 = uint64_t;
|
|||||||
|
|
||||||
using Int128 = __int128;
|
using Int128 = __int128;
|
||||||
|
|
||||||
/// We have to use 127 and 255 bit integers to safe a bit for a sign serialization
|
using wInt256 = std::wide_integer<256, signed>;
|
||||||
//using bInt256 = boost::multiprecision::int256_t;
|
using wUInt256 = std::wide_integer<256, unsigned>;
|
||||||
using bInt256 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<
|
|
||||||
255, 255, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> >;
|
|
||||||
using bUInt256 = boost::multiprecision::uint256_t;
|
|
||||||
|
|
||||||
|
static_assert(sizeof(wInt256) == 32);
|
||||||
|
static_assert(sizeof(wUInt256) == 32);
|
||||||
|
|
||||||
using String = std::string;
|
using String = std::string;
|
||||||
|
|
||||||
@ -44,7 +43,7 @@ struct is_signed
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <> struct is_signed<Int128> { static constexpr bool value = true; };
|
template <> struct is_signed<Int128> { static constexpr bool value = true; };
|
||||||
template <> struct is_signed<bInt256> { static constexpr bool value = true; };
|
template <> struct is_signed<wInt256> { static constexpr bool value = true; };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_signed_v = is_signed<T>::value;
|
inline constexpr bool is_signed_v = is_signed<T>::value;
|
||||||
@ -55,7 +54,7 @@ struct is_unsigned
|
|||||||
static constexpr bool value = std::is_unsigned_v<T>;
|
static constexpr bool value = std::is_unsigned_v<T>;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct is_unsigned<bUInt256> { static constexpr bool value = true; };
|
template <> struct is_unsigned<wUInt256> { static constexpr bool value = true; };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_unsigned_v = is_unsigned<T>::value;
|
inline constexpr bool is_unsigned_v = is_unsigned<T>::value;
|
||||||
@ -69,8 +68,8 @@ struct is_integer
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <> struct is_integer<Int128> { static constexpr bool value = true; };
|
template <> struct is_integer<Int128> { static constexpr bool value = true; };
|
||||||
template <> struct is_integer<bInt256> { static constexpr bool value = true; };
|
template <> struct is_integer<wInt256> { static constexpr bool value = true; };
|
||||||
template <> struct is_integer<bUInt256> { static constexpr bool value = true; };
|
template <> struct is_integer<wUInt256> { static constexpr bool value = true; };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_integer_v = is_integer<T>::value;
|
inline constexpr bool is_integer_v = is_integer<T>::value;
|
||||||
@ -93,9 +92,9 @@ struct make_unsigned
|
|||||||
typedef std::make_unsigned_t<T> type;
|
typedef std::make_unsigned_t<T> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct make_unsigned<__int128> { using type = unsigned __int128; };
|
template <> struct make_unsigned<Int128> { using type = unsigned __int128; };
|
||||||
template <> struct make_unsigned<bInt256> { using type = bUInt256; };
|
template <> struct make_unsigned<wInt256> { using type = wUInt256; };
|
||||||
template <> struct make_unsigned<bUInt256> { using type = bUInt256; };
|
template <> struct make_unsigned<wUInt256> { using type = wUInt256; };
|
||||||
|
|
||||||
template <typename T> using make_unsigned_t = typename make_unsigned<T>::type;
|
template <typename T> using make_unsigned_t = typename make_unsigned<T>::type;
|
||||||
|
|
||||||
@ -105,8 +104,8 @@ struct make_signed
|
|||||||
typedef std::make_signed_t<T> type;
|
typedef std::make_signed_t<T> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct make_signed<bInt256> { typedef bInt256 type; };
|
template <> struct make_signed<wInt256> { using type = wInt256; };
|
||||||
template <> struct make_signed<bUInt256> { typedef bInt256 type; };
|
template <> struct make_signed<wUInt256> { using type = wInt256; };
|
||||||
|
|
||||||
template <typename T> using make_signed_t = typename make_signed<T>::type;
|
template <typename T> using make_signed_t = typename make_signed<T>::type;
|
||||||
|
|
||||||
@ -116,8 +115,8 @@ struct is_big_int
|
|||||||
static constexpr bool value = false;
|
static constexpr bool value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct is_big_int<bUInt256> { static constexpr bool value = true; };
|
template <> struct is_big_int<wInt256> { static constexpr bool value = true; };
|
||||||
template <> struct is_big_int<bInt256> { static constexpr bool value = true; };
|
template <> struct is_big_int<wUInt256> { static constexpr bool value = true; };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_big_int_v = is_big_int<T>::value;
|
inline constexpr bool is_big_int_v = is_big_int<T>::value;
|
||||||
@ -125,14 +124,11 @@ inline constexpr bool is_big_int_v = is_big_int<T>::value;
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
inline std::string bigintToString(const T & x)
|
inline std::string bigintToString(const T & x)
|
||||||
{
|
{
|
||||||
return x.str();
|
return to_string(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename To, typename From>
|
template <typename To, typename From>
|
||||||
inline To bigint_cast(const From & x [[maybe_unused]])
|
inline To bigint_cast(const From & x [[maybe_unused]])
|
||||||
{
|
{
|
||||||
if constexpr ((is_big_int_v<From> && std::is_same_v<To, UInt8>) || (is_big_int_v<To> && std::is_same_v<From, UInt8>))
|
return static_cast<To>(x);
|
||||||
return static_cast<uint8_t>(x);
|
|
||||||
else
|
|
||||||
return static_cast<To>(x);
|
|
||||||
}
|
}
|
||||||
|
249
base/common/wide_integer.h
Normal file
249
base/common/wide_integer.h
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// (See at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/* Divide and multiply
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008
|
||||||
|
* Evan Teran
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software and its
|
||||||
|
* documentation for any purpose and without fee is hereby granted, provided
|
||||||
|
* that the above copyright notice appears in all copies and that both the
|
||||||
|
* copyright notice and this permission notice appear in supporting
|
||||||
|
* documentation, and that the same name not be used in advertising or
|
||||||
|
* publicity pertaining to distribution of the software without specific,
|
||||||
|
* written prior permission. We make no representations about the
|
||||||
|
* suitability this software for any purpose. It is provided "as is"
|
||||||
|
* without express or implied warranty.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <climits> // CHAR_BIT
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <limits>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
template <size_t Bits, typename Signed>
|
||||||
|
class wide_integer;
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, size_t Bits2, typename Signed2>
|
||||||
|
struct common_type<wide_integer<Bits, Signed>, wide_integer<Bits2, Signed2>>;
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, typename Arithmetic>
|
||||||
|
struct common_type<wide_integer<Bits, Signed>, Arithmetic>;
|
||||||
|
|
||||||
|
template <typename Arithmetic, size_t Bits, typename Signed>
|
||||||
|
struct common_type<Arithmetic, wide_integer<Bits, Signed>>;
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed>
|
||||||
|
class wide_integer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using base_type = uint8_t;
|
||||||
|
using signed_base_type = int8_t;
|
||||||
|
|
||||||
|
// ctors
|
||||||
|
wide_integer() = default;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
constexpr wide_integer(T rhs) noexcept;
|
||||||
|
template <typename T>
|
||||||
|
constexpr wide_integer(std::initializer_list<T> il) noexcept;
|
||||||
|
|
||||||
|
// assignment
|
||||||
|
template <size_t Bits2, typename Signed2>
|
||||||
|
constexpr wide_integer<Bits, Signed> & operator=(const wide_integer<Bits2, Signed2> & rhs) noexcept;
|
||||||
|
|
||||||
|
template <typename Arithmetic>
|
||||||
|
constexpr wide_integer<Bits, Signed> & operator=(Arithmetic rhs) noexcept;
|
||||||
|
|
||||||
|
template <typename Arithmetic>
|
||||||
|
constexpr wide_integer<Bits, Signed> & operator*=(const Arithmetic & rhs);
|
||||||
|
|
||||||
|
template <typename Arithmetic>
|
||||||
|
constexpr wide_integer<Bits, Signed> & operator/=(const Arithmetic & rhs);
|
||||||
|
|
||||||
|
template <typename Arithmetic>
|
||||||
|
constexpr wide_integer<Bits, Signed> & operator+=(const Arithmetic & rhs) noexcept(is_same<Signed, unsigned>::value);
|
||||||
|
|
||||||
|
template <typename Arithmetic>
|
||||||
|
constexpr wide_integer<Bits, Signed> & operator-=(const Arithmetic & rhs) noexcept(is_same<Signed, unsigned>::value);
|
||||||
|
|
||||||
|
template <typename Integral>
|
||||||
|
constexpr wide_integer<Bits, Signed> & operator%=(const Integral & rhs);
|
||||||
|
|
||||||
|
template <typename Integral>
|
||||||
|
constexpr wide_integer<Bits, Signed> & operator&=(const Integral & rhs) noexcept;
|
||||||
|
|
||||||
|
template <typename Integral>
|
||||||
|
constexpr wide_integer<Bits, Signed> & operator|=(const Integral & rhs) noexcept;
|
||||||
|
|
||||||
|
template <typename Integral>
|
||||||
|
constexpr wide_integer<Bits, Signed> & operator^=(const Integral & rhs) noexcept;
|
||||||
|
|
||||||
|
constexpr wide_integer<Bits, Signed> & operator<<=(int n);
|
||||||
|
constexpr wide_integer<Bits, Signed> & operator>>=(int n) noexcept;
|
||||||
|
|
||||||
|
constexpr wide_integer<Bits, Signed> & operator++() noexcept(is_same<Signed, unsigned>::value);
|
||||||
|
constexpr wide_integer<Bits, Signed> operator++(int) noexcept(is_same<Signed, unsigned>::value);
|
||||||
|
constexpr wide_integer<Bits, Signed> & operator--() noexcept(is_same<Signed, unsigned>::value);
|
||||||
|
constexpr wide_integer<Bits, Signed> operator--(int) noexcept(is_same<Signed, unsigned>::value);
|
||||||
|
|
||||||
|
// observers
|
||||||
|
|
||||||
|
constexpr explicit operator bool() const noexcept;
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
using __integral_not_wide_integer_class = typename std::enable_if<std::is_arithmetic<T>::value, T>::type;
|
||||||
|
|
||||||
|
template <class T, class = __integral_not_wide_integer_class<T>>
|
||||||
|
constexpr operator T() const noexcept;
|
||||||
|
|
||||||
|
constexpr operator long double() const noexcept;
|
||||||
|
constexpr operator double() const noexcept;
|
||||||
|
constexpr operator float() const noexcept;
|
||||||
|
|
||||||
|
struct _impl;
|
||||||
|
|
||||||
|
private:
|
||||||
|
template <size_t Bits2, typename Signed2>
|
||||||
|
friend class wide_integer;
|
||||||
|
|
||||||
|
friend class numeric_limits<wide_integer<Bits, signed>>;
|
||||||
|
friend class numeric_limits<wide_integer<Bits, unsigned>>;
|
||||||
|
|
||||||
|
base_type m_arr[_impl::arr_size];
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
static constexpr bool ArithmeticConcept() noexcept;
|
||||||
|
template <class T1, class T2>
|
||||||
|
using __only_arithmetic = typename std::enable_if<ArithmeticConcept<T1>() && ArithmeticConcept<T2>()>::type;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
static constexpr bool IntegralConcept() noexcept;
|
||||||
|
template <class T, class T2>
|
||||||
|
using __only_integer = typename std::enable_if<IntegralConcept<T>() && IntegralConcept<T2>()>::type;
|
||||||
|
|
||||||
|
// Unary operators
|
||||||
|
template <size_t Bits, typename Signed>
|
||||||
|
constexpr wide_integer<Bits, Signed> operator~(const wide_integer<Bits, Signed> & lhs) noexcept;
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed>
|
||||||
|
constexpr wide_integer<Bits, Signed> operator-(const wide_integer<Bits, Signed> & lhs) noexcept(is_same<Signed, unsigned>::value);
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed>
|
||||||
|
constexpr wide_integer<Bits, Signed> operator+(const wide_integer<Bits, Signed> & lhs) noexcept(is_same<Signed, unsigned>::value);
|
||||||
|
|
||||||
|
// Binary operators
|
||||||
|
template <size_t Bits, typename Signed, size_t Bits2, typename Signed2>
|
||||||
|
std::common_type_t<wide_integer<Bits, Signed>, wide_integer<Bits2, Signed2>> constexpr
|
||||||
|
operator*(const wide_integer<Bits, Signed> & lhs, const wide_integer<Bits2, Signed2> & rhs);
|
||||||
|
template <typename Arithmetic, typename Arithmetic2, class = __only_arithmetic<Arithmetic, Arithmetic2>>
|
||||||
|
std::common_type_t<Arithmetic, Arithmetic2> constexpr operator*(const Arithmetic & rhs, const Arithmetic2 & lhs);
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, size_t Bits2, typename Signed2>
|
||||||
|
std::common_type_t<wide_integer<Bits, Signed>, wide_integer<Bits2, Signed2>> constexpr
|
||||||
|
operator/(const wide_integer<Bits, Signed> & lhs, const wide_integer<Bits2, Signed2> & rhs);
|
||||||
|
template <typename Arithmetic, typename Arithmetic2, class = __only_arithmetic<Arithmetic, Arithmetic2>>
|
||||||
|
std::common_type_t<Arithmetic, Arithmetic2> constexpr operator/(const Arithmetic & rhs, const Arithmetic2 & lhs);
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, size_t Bits2, typename Signed2>
|
||||||
|
std::common_type_t<wide_integer<Bits, Signed>, wide_integer<Bits2, Signed2>> constexpr
|
||||||
|
operator+(const wide_integer<Bits, Signed> & lhs, const wide_integer<Bits2, Signed2> & rhs);
|
||||||
|
template <typename Arithmetic, typename Arithmetic2, class = __only_arithmetic<Arithmetic, Arithmetic2>>
|
||||||
|
std::common_type_t<Arithmetic, Arithmetic2> constexpr operator+(const Arithmetic & rhs, const Arithmetic2 & lhs);
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, size_t Bits2, typename Signed2>
|
||||||
|
std::common_type_t<wide_integer<Bits, Signed>, wide_integer<Bits2, Signed2>> constexpr
|
||||||
|
operator-(const wide_integer<Bits, Signed> & lhs, const wide_integer<Bits2, Signed2> & rhs);
|
||||||
|
template <typename Arithmetic, typename Arithmetic2, class = __only_arithmetic<Arithmetic, Arithmetic2>>
|
||||||
|
std::common_type_t<Arithmetic, Arithmetic2> constexpr operator-(const Arithmetic & rhs, const Arithmetic2 & lhs);
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, size_t Bits2, typename Signed2>
|
||||||
|
std::common_type_t<wide_integer<Bits, Signed>, wide_integer<Bits2, Signed2>> constexpr
|
||||||
|
operator%(const wide_integer<Bits, Signed> & lhs, const wide_integer<Bits2, Signed2> & rhs);
|
||||||
|
template <typename Integral, typename Integral2, class = __only_integer<Integral, Integral2>>
|
||||||
|
std::common_type_t<Integral, Integral2> constexpr operator%(const Integral & rhs, const Integral2 & lhs);
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, size_t Bits2, typename Signed2>
|
||||||
|
std::common_type_t<wide_integer<Bits, Signed>, wide_integer<Bits2, Signed2>> constexpr
|
||||||
|
operator&(const wide_integer<Bits, Signed> & lhs, const wide_integer<Bits2, Signed2> & rhs);
|
||||||
|
template <typename Integral, typename Integral2, class = __only_integer<Integral, Integral2>>
|
||||||
|
std::common_type_t<Integral, Integral2> constexpr operator&(const Integral & rhs, const Integral2 & lhs);
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, size_t Bits2, typename Signed2>
|
||||||
|
std::common_type_t<wide_integer<Bits, Signed>, wide_integer<Bits2, Signed2>> constexpr
|
||||||
|
operator|(const wide_integer<Bits, Signed> & lhs, const wide_integer<Bits2, Signed2> & rhs);
|
||||||
|
template <typename Integral, typename Integral2, class = __only_integer<Integral, Integral2>>
|
||||||
|
std::common_type_t<Integral, Integral2> constexpr operator|(const Integral & rhs, const Integral2 & lhs);
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, size_t Bits2, typename Signed2>
|
||||||
|
std::common_type_t<wide_integer<Bits, Signed>, wide_integer<Bits2, Signed2>> constexpr
|
||||||
|
operator^(const wide_integer<Bits, Signed> & lhs, const wide_integer<Bits2, Signed2> & rhs);
|
||||||
|
template <typename Integral, typename Integral2, class = __only_integer<Integral, Integral2>>
|
||||||
|
std::common_type_t<Integral, Integral2> constexpr operator^(const Integral & rhs, const Integral2 & lhs);
|
||||||
|
|
||||||
|
// TODO: Integral
|
||||||
|
template <size_t Bits, typename Signed>
|
||||||
|
constexpr wide_integer<Bits, Signed> operator<<(const wide_integer<Bits, Signed> & lhs, int n) noexcept;
|
||||||
|
template <size_t Bits, typename Signed>
|
||||||
|
constexpr wide_integer<Bits, Signed> operator>>(const wide_integer<Bits, Signed> & lhs, int n) noexcept;
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, typename Int, typename = std::enable_if_t<!std::is_same_v<Int, int>>>
|
||||||
|
constexpr wide_integer<Bits, Signed> operator<<(const wide_integer<Bits, Signed> & lhs, Int n) noexcept
|
||||||
|
{
|
||||||
|
return lhs << int(n);
|
||||||
|
}
|
||||||
|
template <size_t Bits, typename Signed, typename Int, typename = std::enable_if_t<!std::is_same_v<Int, int>>>
|
||||||
|
constexpr wide_integer<Bits, Signed> operator>>(const wide_integer<Bits, Signed> & lhs, Int n) noexcept
|
||||||
|
{
|
||||||
|
return lhs >> int(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, size_t Bits2, typename Signed2>
|
||||||
|
constexpr bool operator<(const wide_integer<Bits, Signed> & lhs, const wide_integer<Bits2, Signed2> & rhs);
|
||||||
|
template <typename Arithmetic, typename Arithmetic2, class = __only_arithmetic<Arithmetic, Arithmetic2>>
|
||||||
|
constexpr bool operator<(const Arithmetic & rhs, const Arithmetic2 & lhs);
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, size_t Bits2, typename Signed2>
|
||||||
|
constexpr bool operator>(const wide_integer<Bits, Signed> & lhs, const wide_integer<Bits2, Signed2> & rhs);
|
||||||
|
template <typename Arithmetic, typename Arithmetic2, class = __only_arithmetic<Arithmetic, Arithmetic2>>
|
||||||
|
constexpr bool operator>(const Arithmetic & rhs, const Arithmetic2 & lhs);
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, size_t Bits2, typename Signed2>
|
||||||
|
constexpr bool operator<=(const wide_integer<Bits, Signed> & lhs, const wide_integer<Bits2, Signed2> & rhs);
|
||||||
|
template <typename Arithmetic, typename Arithmetic2, class = __only_arithmetic<Arithmetic, Arithmetic2>>
|
||||||
|
constexpr bool operator<=(const Arithmetic & rhs, const Arithmetic2 & lhs);
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, size_t Bits2, typename Signed2>
|
||||||
|
constexpr bool operator>=(const wide_integer<Bits, Signed> & lhs, const wide_integer<Bits2, Signed2> & rhs);
|
||||||
|
template <typename Arithmetic, typename Arithmetic2, class = __only_arithmetic<Arithmetic, Arithmetic2>>
|
||||||
|
constexpr bool operator>=(const Arithmetic & rhs, const Arithmetic2 & lhs);
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, size_t Bits2, typename Signed2>
|
||||||
|
constexpr bool operator==(const wide_integer<Bits, Signed> & lhs, const wide_integer<Bits2, Signed2> & rhs);
|
||||||
|
template <typename Arithmetic, typename Arithmetic2, class = __only_arithmetic<Arithmetic, Arithmetic2>>
|
||||||
|
constexpr bool operator==(const Arithmetic & rhs, const Arithmetic2 & lhs);
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed, size_t Bits2, typename Signed2>
|
||||||
|
constexpr bool operator!=(const wide_integer<Bits, Signed> & lhs, const wide_integer<Bits2, Signed2> & rhs);
|
||||||
|
template <typename Arithmetic, typename Arithmetic2, class = __only_arithmetic<Arithmetic, Arithmetic2>>
|
||||||
|
constexpr bool operator!=(const Arithmetic & rhs, const Arithmetic2 & lhs);
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed>
|
||||||
|
std::string to_string(const wide_integer<Bits, Signed> & n);
|
||||||
|
|
||||||
|
template <size_t Bits, typename Signed>
|
||||||
|
struct hash<wide_integer<Bits, Signed>>;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "wide_integer_impl.h"
|
1301
base/common/wide_integer_impl.h
Normal file
1301
base/common/wide_integer_impl.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -126,7 +126,7 @@ public:
|
|||||||
|
|
||||||
bool isNumeric() const override { return false; }
|
bool isNumeric() const override { return false; }
|
||||||
bool canBeInsideNullable() const override { return true; }
|
bool canBeInsideNullable() const override { return true; }
|
||||||
bool isFixedAndContiguous() const override { return is_POD; }
|
bool isFixedAndContiguous() const override { return true; }
|
||||||
size_t sizeOfValueIfFixed() const override { return sizeof(T); }
|
size_t sizeOfValueIfFixed() const override { return sizeof(T); }
|
||||||
|
|
||||||
size_t size() const override { return data.size(); }
|
size_t size() const override { return data.size(); }
|
||||||
|
@ -12,11 +12,6 @@
|
|||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace ErrorCodes
|
|
||||||
{
|
|
||||||
extern const int NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Stuff for comparing numbers.
|
/** Stuff for comparing numbers.
|
||||||
* Integer values are compared as usual.
|
* Integer values are compared as usual.
|
||||||
* Floating-point numbers are compared this way that NaNs always end up at the end
|
* Floating-point numbers are compared this way that NaNs always end up at the end
|
||||||
@ -298,23 +293,17 @@ public:
|
|||||||
void gather(ColumnGathererStream & gatherer_stream) override;
|
void gather(ColumnGathererStream & gatherer_stream) override;
|
||||||
|
|
||||||
bool canBeInsideNullable() const override { return true; }
|
bool canBeInsideNullable() const override { return true; }
|
||||||
bool isFixedAndContiguous() const override { return is_POD; }
|
bool isFixedAndContiguous() const override { return true; }
|
||||||
size_t sizeOfValueIfFixed() const override { return sizeof(T); }
|
size_t sizeOfValueIfFixed() const override { return sizeof(T); }
|
||||||
|
|
||||||
StringRef getRawData() const override
|
StringRef getRawData() const override
|
||||||
{
|
{
|
||||||
if constexpr (is_POD)
|
return StringRef(reinterpret_cast<const char*>(data.data()), byteSize());
|
||||||
return StringRef(reinterpret_cast<const char*>(data.data()), byteSize());
|
|
||||||
else
|
|
||||||
throw Exception("getRawData() is not implemented for big integers", ErrorCodes::NOT_IMPLEMENTED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StringRef getDataAt(size_t n) const override
|
StringRef getDataAt(size_t n) const override
|
||||||
{
|
{
|
||||||
if constexpr (is_POD)
|
return StringRef(reinterpret_cast<const char *>(&data[n]), sizeof(data[n]));
|
||||||
return StringRef(reinterpret_cast<const char *>(&data[n]), sizeof(data[n]));
|
|
||||||
else
|
|
||||||
throw Exception("getDataAt() is not implemented for big integers", ErrorCodes::NOT_IMPLEMENTED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool structureEquals(const IColumn & rhs) const override
|
bool structureEquals(const IColumn & rhs) const override
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Core/Types.h>
|
#include <Core/Types.h>
|
||||||
|
#include <Core/BigInt.h>
|
||||||
#include <Common/UInt128.h>
|
#include <Common/UInt128.h>
|
||||||
#include <common/unaligned.h>
|
#include <common/unaligned.h>
|
||||||
|
|
||||||
@ -89,8 +90,7 @@ template <typename T>
|
|||||||
inline typename std::enable_if<is_big_int_v<T>, DB::UInt64>::type
|
inline typename std::enable_if<is_big_int_v<T>, DB::UInt64>::type
|
||||||
intHashCRC32(const T & x, DB::UInt64 updated_value)
|
intHashCRC32(const T & x, DB::UInt64 updated_value)
|
||||||
{
|
{
|
||||||
std::vector<UInt64> parts;
|
std::vector<UInt64> parts = DB::BigInt<T>::toIntArray(x);
|
||||||
export_bits(x, std::back_inserter(parts), sizeof(UInt64), false);
|
|
||||||
for (const auto & part : parts)
|
for (const auto & part : parts)
|
||||||
updated_value = intHashCRC32(part, updated_value);
|
updated_value = intHashCRC32(part, updated_value);
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ inline size_t DefaultHash64(std::enable_if_t<(sizeof(T) > sizeof(UInt64)), T> ke
|
|||||||
{
|
{
|
||||||
return intHash64(key.low ^ key.high);
|
return intHash64(key.low ^ key.high);
|
||||||
}
|
}
|
||||||
else if constexpr (std::is_same_v<T, bInt256> || std::is_same_v<T, bUInt256>)
|
else if constexpr (is_big_int_v<T> && sizeof(T) == 32)
|
||||||
{
|
{
|
||||||
return intHash64(static_cast<UInt64>(key) ^
|
return intHash64(static_cast<UInt64>(key) ^
|
||||||
static_cast<UInt64>(key >> 64) ^
|
static_cast<UInt64>(key >> 64) ^
|
||||||
@ -256,7 +256,7 @@ inline size_t hashCRC32(std::enable_if_t<(sizeof(T) > sizeof(UInt64)), T> key)
|
|||||||
{
|
{
|
||||||
return intHashCRC32(key.low ^ key.high);
|
return intHashCRC32(key.low ^ key.high);
|
||||||
}
|
}
|
||||||
else if constexpr (std::is_same_v<T, bInt256> || std::is_same_v<T, bUInt256>)
|
else if constexpr (is_big_int_v<T> && sizeof(T) == 32)
|
||||||
{
|
{
|
||||||
return intHashCRC32(static_cast<UInt64>(key) ^
|
return intHashCRC32(static_cast<UInt64>(key) ^
|
||||||
static_cast<UInt64>(key >> 64) ^
|
static_cast<UInt64>(key >> 64) ^
|
||||||
@ -358,7 +358,7 @@ struct IntHash32
|
|||||||
{
|
{
|
||||||
return intHash32<salt>(key.low ^ key.high);
|
return intHash32<salt>(key.low ^ key.high);
|
||||||
}
|
}
|
||||||
else if constexpr (std::is_same_v<T, bInt256> || std::is_same_v<T, bUInt256>)
|
else if constexpr (is_big_int_v<T> && sizeof(T) == 32)
|
||||||
{
|
{
|
||||||
return intHash32<salt>(static_cast<UInt64>(key) ^
|
return intHash32<salt>(static_cast<UInt64>(key) ^
|
||||||
static_cast<UInt64>(key >> 64) ^
|
static_cast<UInt64>(key >> 64) ^
|
||||||
|
@ -148,7 +148,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::enable_if_t<is_big_int_v<T>, void> update(const T & x)
|
std::enable_if_t<is_big_int_v<T> && !std::has_unique_object_representations_v<T>, void> update(const T & x)
|
||||||
{
|
{
|
||||||
update(DB::BigInt<T>::serialize(x));
|
update(DB::BigInt<T>::serialize(x));
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ std::enable_if_t<std::has_unique_object_representations_v<T>, UInt64> sipHash64(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::enable_if_t<(std::is_floating_point_v<T> || is_big_int_v<T>), UInt64> sipHash64(const T & x)
|
std::enable_if_t<(std::is_floating_point_v<T> || (is_big_int_v<T> && !std::has_unique_object_representations_v<T>)), UInt64> sipHash64(const T & x)
|
||||||
{
|
{
|
||||||
SipHash hash;
|
SipHash hash;
|
||||||
hash.update(x);
|
hash.update(x);
|
||||||
|
@ -67,6 +67,11 @@ struct UInt128
|
|||||||
bool inline operator <= (const Int128 rhs) const { return *this <= UInt128(rhs, rhs >> 64) && rhs >= 0; }
|
bool inline operator <= (const Int128 rhs) const { return *this <= UInt128(rhs, rhs >> 64) && rhs >= 0; }
|
||||||
bool inline operator < (const Int128 rhs) const { return *this < UInt128(rhs, rhs >> 64) && rhs >= 0; }
|
bool inline operator < (const Int128 rhs) const { return *this < UInt128(rhs, rhs >> 64) && rhs >= 0; }
|
||||||
|
|
||||||
|
bool inline operator > (const Int256 rhs) const { return (rhs < 0) || ((Int256(high) << 64) + low) > rhs; }
|
||||||
|
bool inline operator > (const UInt256 rhs) const { return ((UInt256(high) << 64) + low) > rhs; }
|
||||||
|
bool inline operator < (const Int256 rhs) const { return (rhs >= 0) && ((Int256(high) << 64) + low) < rhs; }
|
||||||
|
bool inline operator < (const UInt256 rhs) const { return ((UInt256(high) << 64) + low) < rhs; }
|
||||||
|
|
||||||
template <typename T> bool inline operator== (const T rhs) const { return *this == UInt128(rhs); }
|
template <typename T> bool inline operator== (const T rhs) const { return *this == UInt128(rhs); }
|
||||||
template <typename T> bool inline operator!= (const T rhs) const { return *this != UInt128(rhs); }
|
template <typename T> bool inline operator!= (const T rhs) const { return *this != UInt128(rhs); }
|
||||||
template <typename T> bool inline operator>= (const T rhs) const { return *this >= UInt128(rhs); }
|
template <typename T> bool inline operator>= (const T rhs) const { return *this >= UInt128(rhs); }
|
||||||
|
@ -138,9 +138,9 @@ constexpr inline Int128 exp10_i128(int x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bInt256 exp10_i256(int x)
|
inline wInt256 exp10_i256(int x)
|
||||||
{
|
{
|
||||||
using Int256 = bInt256;
|
using Int256 = wInt256;
|
||||||
static constexpr Int256 i10e18{1000000000000000000ll};
|
static constexpr Int256 i10e18{1000000000000000000ll};
|
||||||
static const Int256 values[] = {
|
static const Int256 values[] = {
|
||||||
static_cast<Int256>(1ll),
|
static_cast<Int256>(1ll),
|
||||||
|
@ -7,46 +7,15 @@ namespace DB
|
|||||||
{
|
{
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct BigIntPayload
|
struct BigInt
|
||||||
{
|
{
|
||||||
static_assert(!is_big_int_v<T>);
|
static_assert(sizeof(T) == 32);
|
||||||
static constexpr size_t size = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct BigIntPayload<bUInt256> { static constexpr size_t size = 32; };
|
|
||||||
|
|
||||||
template <> struct BigIntPayload<bInt256>
|
|
||||||
{
|
|
||||||
using UnsingedType = bUInt256;
|
|
||||||
static constexpr size_t size = 32;
|
static constexpr size_t size = 32;
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct BigInt : BigIntPayload<T>
|
|
||||||
{
|
|
||||||
using BigIntPayload<T>::size;
|
|
||||||
|
|
||||||
static constexpr size_t lastBit()
|
|
||||||
{
|
|
||||||
return size * 8 - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static StringRef serialize(const T & x, char * pos)
|
static StringRef serialize(const T & x, char * pos)
|
||||||
{
|
{
|
||||||
if constexpr (is_signed_v<T>)
|
//unalignedStore<T>(pos, x);
|
||||||
{
|
memcpy(pos, &x, size);
|
||||||
using UnsignedT = typename BigIntPayload<T>::UnsingedType;
|
|
||||||
|
|
||||||
if (x < 0)
|
|
||||||
{
|
|
||||||
UnsignedT unsigned_x = UnsignedT{0} - static_cast<UnsignedT>(-x);
|
|
||||||
export_bits(unsigned_x, pos, 8, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
export_bits(x, pos, 8, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
export_bits(x, pos, 8, false);
|
|
||||||
return StringRef(pos, size);
|
return StringRef(pos, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,24 +28,20 @@ struct BigInt : BigIntPayload<T>
|
|||||||
|
|
||||||
static T deserialize(const char * pos)
|
static T deserialize(const char * pos)
|
||||||
{
|
{
|
||||||
if constexpr (is_signed_v<T>)
|
//return unalignedLoad<T>(pos);
|
||||||
{
|
T res;
|
||||||
using UnsignedT = typename BigIntPayload<T>::UnsingedType;
|
memcpy(&res, pos, size);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
UnsignedT unsigned_x;
|
static std::vector<UInt64> toIntArray(const T & x)
|
||||||
import_bits(unsigned_x, pos, pos + size, false);
|
{
|
||||||
|
std::vector<UInt64> parts(4, 0);
|
||||||
bool is_negative = bit_test(unsigned_x, lastBit());
|
parts[0] = UInt64(x);
|
||||||
if (is_negative)
|
parts[1] = UInt64(x >> 64);
|
||||||
unsigned_x = UnsignedT{0} - unsigned_x;
|
parts[2] = UInt64(x >> 128);
|
||||||
return static_cast<T>(unsigned_x);
|
parts[4] = UInt64(x >> 192);
|
||||||
}
|
return parts;
|
||||||
else
|
|
||||||
{
|
|
||||||
T x;
|
|
||||||
import_bits(x, pos, pos + size, false);
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -226,25 +226,25 @@ private:
|
|||||||
static NO_INLINE UInt8 apply(A a, B b, CompareInt scale [[maybe_unused]])
|
static NO_INLINE UInt8 apply(A a, B b, CompareInt scale [[maybe_unused]])
|
||||||
{
|
{
|
||||||
CompareInt x;
|
CompareInt x;
|
||||||
if constexpr (is_big_int_v<CompareInt> && IsDecimalNumber<A>)
|
if constexpr (IsDecimalNumber<A>)
|
||||||
x = a.value;
|
x = a.value;
|
||||||
else
|
else
|
||||||
x = bigint_cast<CompareInt>(a);
|
x = a;
|
||||||
|
|
||||||
CompareInt y;
|
CompareInt y;
|
||||||
if constexpr (is_big_int_v<CompareInt> && IsDecimalNumber<B>)
|
if constexpr (IsDecimalNumber<B>)
|
||||||
y = b.value;
|
y = b.value;
|
||||||
else
|
else
|
||||||
y = bigint_cast<CompareInt>(b);
|
y = b;
|
||||||
|
|
||||||
if constexpr (_check_overflow)
|
if constexpr (_check_overflow)
|
||||||
{
|
{
|
||||||
bool overflow = false;
|
bool overflow = false;
|
||||||
|
|
||||||
if constexpr (sizeof(A) > sizeof(CompareInt))
|
if constexpr (sizeof(A) > sizeof(CompareInt))
|
||||||
overflow |= (A(x) != a);
|
overflow |= (bigint_cast<A>(x) != a);
|
||||||
if constexpr (sizeof(B) > sizeof(CompareInt))
|
if constexpr (sizeof(B) > sizeof(CompareInt))
|
||||||
overflow |= (B(y) != b);
|
overflow |= (bigint_cast<B>(y) != b);
|
||||||
if constexpr (is_unsigned_v<A>)
|
if constexpr (is_unsigned_v<A>)
|
||||||
overflow |= (x < 0);
|
overflow |= (x < 0);
|
||||||
if constexpr (is_unsigned_v<B>)
|
if constexpr (is_unsigned_v<B>)
|
||||||
|
@ -58,14 +58,14 @@ using UInt8 = ::UInt8;
|
|||||||
using UInt16 = ::UInt16;
|
using UInt16 = ::UInt16;
|
||||||
using UInt32 = ::UInt32;
|
using UInt32 = ::UInt32;
|
||||||
using UInt64 = ::UInt64;
|
using UInt64 = ::UInt64;
|
||||||
using UInt256 = ::bUInt256;
|
using UInt256 = ::wUInt256;
|
||||||
|
|
||||||
using Int8 = ::Int8;
|
using Int8 = ::Int8;
|
||||||
using Int16 = ::Int16;
|
using Int16 = ::Int16;
|
||||||
using Int32 = ::Int32;
|
using Int32 = ::Int32;
|
||||||
using Int64 = ::Int64;
|
using Int64 = ::Int64;
|
||||||
using Int128 = ::Int128;
|
using Int128 = ::Int128;
|
||||||
using Int256 = ::bInt256;
|
using Int256 = ::wInt256;
|
||||||
|
|
||||||
using Float32 = float;
|
using Float32 = float;
|
||||||
using Float64 = double;
|
using Float64 = double;
|
||||||
|
@ -28,21 +28,13 @@ constexpr size_t min(size_t x, size_t y)
|
|||||||
return x < y ? x : y;
|
return x < y ? x : y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @note There's no auto scale to larger big integer, only for integral ones.
|
||||||
|
/// It's cause of (U)Int64 backward compatibilty and very big performance penalties.
|
||||||
constexpr size_t nextSize(size_t size)
|
constexpr size_t nextSize(size_t size)
|
||||||
{
|
{
|
||||||
return min(size * 2, 8);
|
if (size < 8)
|
||||||
}
|
return size * 2;
|
||||||
|
return size;
|
||||||
template <bool is_signed>
|
|
||||||
constexpr size_t nextSize2(size_t size)
|
|
||||||
{
|
|
||||||
// old way for built-in integers
|
|
||||||
if (size <= 8) return nextSize(size);
|
|
||||||
|
|
||||||
if constexpr (is_signed)
|
|
||||||
return size <= 32 ? 32 : 48;
|
|
||||||
else
|
|
||||||
return size <= 32 ? 16 : 48;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool is_signed, bool is_floating, size_t size>
|
template <bool is_signed, bool is_floating, size_t size>
|
||||||
@ -55,9 +47,8 @@ template <> struct Construct<false, false, 1> { using Type = UInt8; };
|
|||||||
template <> struct Construct<false, false, 2> { using Type = UInt16; };
|
template <> struct Construct<false, false, 2> { using Type = UInt16; };
|
||||||
template <> struct Construct<false, false, 4> { using Type = UInt32; };
|
template <> struct Construct<false, false, 4> { using Type = UInt32; };
|
||||||
template <> struct Construct<false, false, 8> { using Type = UInt64; };
|
template <> struct Construct<false, false, 8> { using Type = UInt64; };
|
||||||
template <> struct Construct<false, false, 16> { using Type = UInt256; };
|
template <> struct Construct<false, false, 16> { using Type = UInt256; }; /// TODO: we cannot use our UInt128 here
|
||||||
template <> struct Construct<false, false, 32> { using Type = UInt256; };
|
template <> struct Construct<false, false, 32> { using Type = UInt256; };
|
||||||
template <> struct Construct<false, false, 48> { using Type = UInt256; };
|
|
||||||
template <> struct Construct<false, true, 1> { using Type = Float32; };
|
template <> struct Construct<false, true, 1> { using Type = Float32; };
|
||||||
template <> struct Construct<false, true, 2> { using Type = Float32; };
|
template <> struct Construct<false, true, 2> { using Type = Float32; };
|
||||||
template <> struct Construct<false, true, 4> { using Type = Float32; };
|
template <> struct Construct<false, true, 4> { using Type = Float32; };
|
||||||
@ -67,8 +58,7 @@ template <> struct Construct<true, false, 2> { using Type = Int16; };
|
|||||||
template <> struct Construct<true, false, 4> { using Type = Int32; };
|
template <> struct Construct<true, false, 4> { using Type = Int32; };
|
||||||
template <> struct Construct<true, false, 8> { using Type = Int64; };
|
template <> struct Construct<true, false, 8> { using Type = Int64; };
|
||||||
template <> struct Construct<true, false, 16> { using Type = Int128; };
|
template <> struct Construct<true, false, 16> { using Type = Int128; };
|
||||||
template <> struct Construct<true, false, 32> { using Type = Int128; };
|
template <> struct Construct<true, false, 32> { using Type = Int256; };
|
||||||
template <> struct Construct<true, false, 48> { using Type = Int256; };
|
|
||||||
template <> struct Construct<true, true, 1> { using Type = Float32; };
|
template <> struct Construct<true, true, 1> { using Type = Float32; };
|
||||||
template <> struct Construct<true, true, 2> { using Type = Float32; };
|
template <> struct Construct<true, true, 2> { using Type = Float32; };
|
||||||
template <> struct Construct<true, true, 4> { using Type = Float32; };
|
template <> struct Construct<true, true, 4> { using Type = Float32; };
|
||||||
@ -86,7 +76,7 @@ template <typename A, typename B> struct ResultOfAdditionMultiplication
|
|||||||
using Type = typename Construct<
|
using Type = typename Construct<
|
||||||
is_signed_v<A> || is_signed_v<B>,
|
is_signed_v<A> || is_signed_v<B>,
|
||||||
std::is_floating_point_v<A> || std::is_floating_point_v<B>,
|
std::is_floating_point_v<A> || std::is_floating_point_v<B>,
|
||||||
nextSize2< is_signed_v<A> || is_signed_v<B> >(max(sizeof(A), sizeof(B)))>::Type;
|
nextSize(max(sizeof(A), sizeof(B)))>::Type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename A, typename B> struct ResultOfSubtraction
|
template <typename A, typename B> struct ResultOfSubtraction
|
||||||
@ -94,7 +84,7 @@ template <typename A, typename B> struct ResultOfSubtraction
|
|||||||
using Type = typename Construct<
|
using Type = typename Construct<
|
||||||
true,
|
true,
|
||||||
std::is_floating_point_v<A> || std::is_floating_point_v<B>,
|
std::is_floating_point_v<A> || std::is_floating_point_v<B>,
|
||||||
nextSize2< is_signed_v<A> || is_signed_v<B> >(max(sizeof(A), sizeof(B)))>::Type;
|
nextSize(max(sizeof(A), sizeof(B)))>::Type;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** When dividing, you always get a floating-point number.
|
/** When dividing, you always get a floating-point number.
|
||||||
@ -127,7 +117,7 @@ template <typename A> struct ResultOfNegate
|
|||||||
using Type = typename Construct<
|
using Type = typename Construct<
|
||||||
true,
|
true,
|
||||||
std::is_floating_point_v<A>,
|
std::is_floating_point_v<A>,
|
||||||
is_signed_v<A> ? sizeof(A) : nextSize2<true>(sizeof(A))>::Type;
|
is_signed_v<A> ? sizeof(A) : nextSize(sizeof(A))>::Type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename A> struct ResultOfAbs
|
template <typename A> struct ResultOfAbs
|
||||||
|
@ -81,8 +81,10 @@ struct DivideIntegralImpl
|
|||||||
/// NOTE: overflow is still possible when dividing large signed number to large unsigned number or vice-versa. But it's less harmful.
|
/// NOTE: overflow is still possible when dividing large signed number to large unsigned number or vice-versa. But it's less harmful.
|
||||||
if constexpr (is_integer_v<A> && is_integer_v<B> && (is_signed_v<A> || is_signed_v<B>))
|
if constexpr (is_integer_v<A> && is_integer_v<B> && (is_signed_v<A> || is_signed_v<B>))
|
||||||
{
|
{
|
||||||
return checkedDivision(make_signed_t<CastA>(a),
|
using SignedCastA = make_signed_t<CastA>;
|
||||||
sizeof(A) > sizeof(B) ? make_signed_t<A>(CastB(b)) : make_signed_t<CastB>(b));
|
using SignedCastB = std::conditional_t<sizeof(A) <= sizeof(B), make_signed_t<CastB>, SignedCastA>;
|
||||||
|
|
||||||
|
return bigint_cast<Result>(checkedDivision(bigint_cast<SignedCastA>(a), bigint_cast<SignedCastB>(b)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return bigint_cast<Result>(checkedDivision(CastA(a), CastB(b)));
|
return bigint_cast<Result>(checkedDivision(CastA(a), CastB(b)));
|
||||||
@ -108,7 +110,7 @@ struct ModuloImpl
|
|||||||
if constexpr (std::is_floating_point_v<ResultType>)
|
if constexpr (std::is_floating_point_v<ResultType>)
|
||||||
{
|
{
|
||||||
/// This computation is similar to `fmod` but the latter is not inlined and has 40 times worse performance.
|
/// This computation is similar to `fmod` but the latter is not inlined and has 40 times worse performance.
|
||||||
return ResultType(a) - trunc(ResultType(a) / ResultType(b)) * ResultType(b);
|
return bigint_cast<ResultType>(a) - trunc(bigint_cast<ResultType>(a) / bigint_cast<ResultType>(b)) * bigint_cast<ResultType>(b);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -125,7 +127,7 @@ struct ModuloImpl
|
|||||||
if constexpr (is_big_int_v<IntegerBType> && sizeof(IntegerAType) <= sizeof(IntegerBType))
|
if constexpr (is_big_int_v<IntegerBType> && sizeof(IntegerAType) <= sizeof(IntegerBType))
|
||||||
return bigint_cast<Result>(bigint_cast<CastB>(int_a) % int_b);
|
return bigint_cast<Result>(bigint_cast<CastB>(int_a) % int_b);
|
||||||
else
|
else
|
||||||
return bigint_cast<Result>(int_a % int_b);
|
return bigint_cast<Result>(int_a % bigint_cast<CastA>(int_b));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return IntegerAType(a) % IntegerBType(b);
|
return IntegerAType(a) % IntegerBType(b);
|
||||||
|
@ -361,12 +361,8 @@ private:
|
|||||||
return apply(a.value, b);
|
return apply(a.value, b);
|
||||||
else if constexpr (IsDecimalNumber<U>)
|
else if constexpr (IsDecimalNumber<U>)
|
||||||
return apply(a, b.value);
|
return apply(a, b.value);
|
||||||
else if constexpr (std::is_same_v<T, UInt8>)
|
|
||||||
return apply(UInt16(a), b);
|
|
||||||
else if constexpr (std::is_same_v<U, UInt8>)
|
|
||||||
return apply(a, UInt16(b));
|
|
||||||
else
|
else
|
||||||
return applyNative(static_cast<NativeResultType>(a), static_cast<NativeResultType>(b));
|
return applyNative(bigint_cast<NativeResultType>(a), bigint_cast<NativeResultType>(b));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return applyNative(a, b);
|
return applyNative(a, b);
|
||||||
@ -381,12 +377,8 @@ private:
|
|||||||
return applyScaled<scale_left>(a.value, b, scale);
|
return applyScaled<scale_left>(a.value, b, scale);
|
||||||
else if constexpr (IsDecimalNumber<U>)
|
else if constexpr (IsDecimalNumber<U>)
|
||||||
return applyScaled<scale_left>(a, b.value, scale);
|
return applyScaled<scale_left>(a, b.value, scale);
|
||||||
else if constexpr (std::is_same_v<T, UInt8>)
|
|
||||||
return applyScaled<scale_left>(UInt16(a), b, scale);
|
|
||||||
else if constexpr (std::is_same_v<U, UInt8>)
|
|
||||||
return applyScaled<scale_left>(a, UInt16(b), scale);
|
|
||||||
else
|
else
|
||||||
return applyNativeScaled<scale_left>(static_cast<NativeResultType>(a), static_cast<NativeResultType>(b), scale);
|
return applyNativeScaled<scale_left>(bigint_cast<NativeResultType>(a), bigint_cast<NativeResultType>(b), scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return applyNativeScaled<scale_left>(a, b, scale);
|
return applyNativeScaled<scale_left>(a, b, scale);
|
||||||
@ -401,12 +393,8 @@ private:
|
|||||||
return applyScaledDiv(a.value, b, scale);
|
return applyScaledDiv(a.value, b, scale);
|
||||||
else if constexpr (IsDecimalNumber<U>)
|
else if constexpr (IsDecimalNumber<U>)
|
||||||
return applyScaledDiv(a, b.value, scale);
|
return applyScaledDiv(a, b.value, scale);
|
||||||
else if constexpr (std::is_same_v<T, UInt8>)
|
|
||||||
return applyScaledDiv(UInt16(a), b, scale);
|
|
||||||
else if constexpr (std::is_same_v<U, UInt8>)
|
|
||||||
return applyScaledDiv(a, UInt16(b), scale);
|
|
||||||
else
|
else
|
||||||
return applyNativeScaledDiv(static_cast<NativeResultType>(a), static_cast<NativeResultType>(b), scale);
|
return applyNativeScaledDiv(bigint_cast<NativeResultType>(a), bigint_cast<NativeResultType>(b), scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return applyNativeScaledDiv(a, b, scale);
|
return applyNativeScaledDiv(a, b, scale);
|
||||||
|
@ -558,7 +558,7 @@ bool sliceEqualElements(const NumericArraySlice<T> & first [[maybe_unused]],
|
|||||||
{
|
{
|
||||||
/// TODO: Decimal scale
|
/// TODO: Decimal scale
|
||||||
if constexpr (IsDecimalNumber<T> && IsDecimalNumber<U>)
|
if constexpr (IsDecimalNumber<T> && IsDecimalNumber<U>)
|
||||||
return accurate::equalsOp(typename T::NativeType(first.data[first_ind]), typename U::NativeType(second.data[second_ind]));
|
return accurate::equalsOp(first.data[first_ind].value, second.data[second_ind].value);
|
||||||
else if constexpr (IsDecimalNumber<T> || IsDecimalNumber<U>)
|
else if constexpr (IsDecimalNumber<T> || IsDecimalNumber<U>)
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
@ -588,7 +588,7 @@ bool insliceEqualElements(const NumericArraySlice<T> & first [[maybe_unused]],
|
|||||||
size_t second_ind [[maybe_unused]])
|
size_t second_ind [[maybe_unused]])
|
||||||
{
|
{
|
||||||
if constexpr (IsDecimalNumber<T>)
|
if constexpr (IsDecimalNumber<T>)
|
||||||
return accurate::equalsOp(typename T::NativeType(first.data[first_ind]), typename T::NativeType(first.data[second_ind]));
|
return accurate::equalsOp(first.data[first_ind].value, first.data[second_ind].value);
|
||||||
else
|
else
|
||||||
return accurate::equalsOp(first.data[first_ind], first.data[second_ind]);
|
return accurate::equalsOp(first.data[first_ind], first.data[second_ind]);
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,10 @@ struct AbsImpl
|
|||||||
{
|
{
|
||||||
if constexpr (IsDecimalNumber<A>)
|
if constexpr (IsDecimalNumber<A>)
|
||||||
return a < A(0) ? A(-a) : a;
|
return a < A(0) ? A(-a) : a;
|
||||||
else if constexpr (is_big_int_v<A>)
|
else if constexpr (is_big_int_v<A> && is_signed_v<A>)
|
||||||
// from boost/multiprecision/number.hpp
|
return (a < 0) ? -a : a;
|
||||||
return static_cast<ResultType>(abs(a));
|
|
||||||
else if constexpr (is_integer_v<A> && is_signed_v<A>)
|
else if constexpr (is_integer_v<A> && is_signed_v<A>)
|
||||||
return a < 0 ? static_cast<ResultType>(~a) + 1 : a;
|
return a < 0 ? static_cast<ResultType>(~a) + 1 : static_cast<ResultType>(a);
|
||||||
else if constexpr (is_integer_v<A> && is_unsigned_v<A>)
|
else if constexpr (is_integer_v<A> && is_unsigned_v<A>)
|
||||||
return static_cast<ResultType>(a);
|
return static_cast<ResultType>(a);
|
||||||
else if constexpr (std::is_floating_point_v<A>)
|
else if constexpr (std::is_floating_point_v<A>)
|
||||||
|
@ -18,7 +18,7 @@ struct BitRotateLeftImpl
|
|||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||||
{
|
{
|
||||||
if constexpr (is_big_int_v<ResultType>)
|
if constexpr (is_big_int_v<A> || is_big_int_v<B>)
|
||||||
throw Exception("Bit rotate is not implemented for big integers", ErrorCodes::NOT_IMPLEMENTED);
|
throw Exception("Bit rotate is not implemented for big integers", ErrorCodes::NOT_IMPLEMENTED);
|
||||||
else
|
else
|
||||||
return (static_cast<Result>(a) << static_cast<Result>(b))
|
return (static_cast<Result>(a) << static_cast<Result>(b))
|
||||||
|
@ -18,7 +18,7 @@ struct BitRotateRightImpl
|
|||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||||
{
|
{
|
||||||
if constexpr (is_big_int_v<ResultType>)
|
if constexpr (is_big_int_v<A> || is_big_int_v<B>)
|
||||||
throw Exception("Bit rotate is not implemented for big integers", ErrorCodes::NOT_IMPLEMENTED);
|
throw Exception("Bit rotate is not implemented for big integers", ErrorCodes::NOT_IMPLEMENTED);
|
||||||
else
|
else
|
||||||
return (static_cast<Result>(a) >> static_cast<Result>(b))
|
return (static_cast<Result>(a) >> static_cast<Result>(b))
|
||||||
|
@ -19,9 +19,9 @@ struct BitShiftLeftImpl
|
|||||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||||
{
|
{
|
||||||
if constexpr (is_big_int_v<B>)
|
if constexpr (is_big_int_v<B>)
|
||||||
throw Exception("BitShiftLeftImpl is not implemented for big integers as second argument", ErrorCodes::NOT_IMPLEMENTED);
|
throw Exception("BitShiftLeft is not implemented for big integers as second argument", ErrorCodes::NOT_IMPLEMENTED);
|
||||||
else if constexpr (is_big_int_v<A>)
|
else if constexpr (is_big_int_v<A>)
|
||||||
return static_cast<Result>(a) << bigint_cast<UInt32>(b);
|
return bigint_cast<Result>(a) << bigint_cast<UInt32>(b);
|
||||||
else
|
else
|
||||||
return static_cast<Result>(a) << static_cast<Result>(b);
|
return static_cast<Result>(a) << static_cast<Result>(b);
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,9 @@ struct BitShiftRightImpl
|
|||||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||||
{
|
{
|
||||||
if constexpr (is_big_int_v<B>)
|
if constexpr (is_big_int_v<B>)
|
||||||
throw Exception("BitRotate is not implemented for big integers as second argument", ErrorCodes::NOT_IMPLEMENTED);
|
throw Exception("BitShiftRight is not implemented for big integers as second argument", ErrorCodes::NOT_IMPLEMENTED);
|
||||||
else if constexpr (is_big_int_v<A>)
|
else if constexpr (is_big_int_v<A>)
|
||||||
return static_cast<Result>(a) >> bigint_cast<UInt32>(b);
|
return bigint_cast<Result>(a) >> bigint_cast<UInt32>(b);
|
||||||
else
|
else
|
||||||
return static_cast<Result>(a) >> static_cast<Result>(b);
|
return static_cast<Result>(a) >> static_cast<Result>(b);
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,8 @@ struct BitTestImpl
|
|||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
NO_SANITIZE_UNDEFINED static inline Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
NO_SANITIZE_UNDEFINED static inline Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||||
{
|
{
|
||||||
if constexpr (is_big_int_v<B>)
|
if constexpr (is_big_int_v<A> || is_big_int_v<B>)
|
||||||
throw Exception("bitTest is not implemented for big integers as second argument", ErrorCodes::NOT_IMPLEMENTED);
|
throw Exception("bitTest is not implemented for big integers as second argument", ErrorCodes::NOT_IMPLEMENTED);
|
||||||
else if constexpr (is_big_int_v<A>)
|
|
||||||
return bit_test(a, static_cast<UInt32>(b));
|
|
||||||
else
|
else
|
||||||
return (typename NumberTraits::ToInteger<A>::Type(a) >> typename NumberTraits::ToInteger<B>::Type(b)) & 1;
|
return (typename NumberTraits::ToInteger<A>::Type(a) >> typename NumberTraits::ToInteger<B>::Type(b)) & 1;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ struct GCDImpl
|
|||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline Result apply([[maybe_unused]] A a, [[maybe_unused]] B b)
|
static inline Result apply([[maybe_unused]] A a, [[maybe_unused]] B b)
|
||||||
{
|
{
|
||||||
if constexpr (is_big_int_v<A> || is_big_int_v<B>)
|
if constexpr (is_big_int_v<A> || is_big_int_v<B> || is_big_int_v<Result>)
|
||||||
throw Exception("GCD is not implemented for big integers", ErrorCodes::NOT_IMPLEMENTED);
|
throw Exception("GCD is not implemented for big integers", ErrorCodes::NOT_IMPLEMENTED);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -40,14 +40,14 @@ struct LCMImpl
|
|||||||
static const constexpr bool allow_fixed_string = false;
|
static const constexpr bool allow_fixed_string = false;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline std::enable_if_t<is_big_int_v<A> || is_big_int_v<B>, Result>
|
static inline std::enable_if_t<is_big_int_v<A> || is_big_int_v<B> || is_big_int_v<Result>, Result>
|
||||||
apply([[maybe_unused]] A a, [[maybe_unused]] B b)
|
apply([[maybe_unused]] A a, [[maybe_unused]] B b)
|
||||||
{
|
{
|
||||||
throw Exception("LCM is not implemented for big integers", ErrorCodes::NOT_IMPLEMENTED);
|
throw Exception("LCM is not implemented for big integers", ErrorCodes::NOT_IMPLEMENTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline std::enable_if_t<!is_big_int_v<A> && !is_big_int_v<B>, Result>
|
static inline std::enable_if_t<!is_big_int_v<A> && !is_big_int_v<B> && !is_big_int_v<Result>, Result>
|
||||||
apply([[maybe_unused]] A a, [[maybe_unused]] B b)
|
apply([[maybe_unused]] A a, [[maybe_unused]] B b)
|
||||||
{
|
{
|
||||||
throwIfDivisionLeadsToFPE(typename NumberTraits::ToInteger<A>::Type(a), typename NumberTraits::ToInteger<B>::Type(b));
|
throwIfDivisionLeadsToFPE(typename NumberTraits::ToInteger<A>::Type(a), typename NumberTraits::ToInteger<B>::Type(b));
|
||||||
|
@ -6,6 +6,11 @@
|
|||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
|
namespace ErrorCodes
|
||||||
|
{
|
||||||
|
extern const int NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline std::enable_if_t<std::is_integral_v<T> && (sizeof(T) <= sizeof(UInt32)), T>
|
inline std::enable_if_t<std::is_integral_v<T> && (sizeof(T) <= sizeof(UInt32)), T>
|
||||||
roundDownToPowerOfTwo(T x)
|
roundDownToPowerOfTwo(T x)
|
||||||
@ -48,10 +53,9 @@ roundDownToPowerOfTwo(T x)
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline std::enable_if_t<is_big_int_v<T>, T>
|
inline std::enable_if_t<is_big_int_v<T>, T>
|
||||||
roundDownToPowerOfTwo(T x)
|
roundDownToPowerOfTwo(T)
|
||||||
{
|
{
|
||||||
// extention from boost/multiprecision/number.hpp
|
throw Exception("roundToExp2() for big integers is not implemented", ErrorCodes::NOT_IMPLEMENTED);
|
||||||
return T(1) << msb(x);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** For integer data types:
|
/** For integer data types:
|
||||||
|
@ -831,6 +831,7 @@ template <> inline void writeText<bool>(const bool & x, WriteBuffer & buf) { wri
|
|||||||
inline void writeText(const char * x, WriteBuffer & buf) { writeEscapedString(x, strlen(x), buf); }
|
inline void writeText(const char * x, WriteBuffer & buf) { writeEscapedString(x, strlen(x), buf); }
|
||||||
inline void writeText(const char * x, size_t size, WriteBuffer & buf) { writeEscapedString(x, size, buf); }
|
inline void writeText(const char * x, size_t size, WriteBuffer & buf) { writeEscapedString(x, size, buf); }
|
||||||
|
|
||||||
|
inline void writeText(const DayNum & x, WriteBuffer & buf) { writeDateText(LocalDate(x), buf); }
|
||||||
inline void writeText(const LocalDate & x, WriteBuffer & buf) { writeDateText(x, buf); }
|
inline void writeText(const LocalDate & x, WriteBuffer & buf) { writeDateText(x, buf); }
|
||||||
inline void writeText(const LocalDateTime & x, WriteBuffer & buf) { writeDateTimeText(x, buf); }
|
inline void writeText(const LocalDateTime & x, WriteBuffer & buf) { writeDateTimeText(x, buf); }
|
||||||
inline void writeText(const UUID & x, WriteBuffer & buf) { writeUUIDText(x, buf); }
|
inline void writeText(const UUID & x, WriteBuffer & buf) { writeUUIDText(x, buf); }
|
||||||
|
@ -160,7 +160,7 @@ inline void readDecimalText(ReadBuffer & buf, T & x, uint32_t precision, uint32_
|
|||||||
" Expected to read decimal with scale {} and precision {}";
|
" Expected to read decimal with scale {} and precision {}";
|
||||||
|
|
||||||
if constexpr (is_big_int_v<typename T::NativeType>)
|
if constexpr (is_big_int_v<typename T::NativeType>)
|
||||||
throw Exception(fmt::format(pattern, digits, x.value.str(), exponent, scale, precision), ErrorCodes::ARGUMENT_OUT_OF_BOUND);
|
throw Exception(fmt::format(pattern, digits, bigintToString(x.value), exponent, scale, precision), ErrorCodes::ARGUMENT_OUT_OF_BOUND);
|
||||||
else
|
else
|
||||||
throw Exception(fmt::format(pattern, digits, x, exponent, scale, precision), ErrorCodes::ARGUMENT_OUT_OF_BOUND);
|
throw Exception(fmt::format(pattern, digits, x, exponent, scale, precision), ErrorCodes::ARGUMENT_OUT_OF_BOUND);
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ inline void readDecimalText(ReadBuffer & buf, T & x, uint32_t precision, uint32_
|
|||||||
{
|
{
|
||||||
/// Too many digits after point. Just cut off excessive digits.
|
/// Too many digits after point. Just cut off excessive digits.
|
||||||
auto divisor = intExp10OfSize<typename T::NativeType>(divisor_exp);
|
auto divisor = intExp10OfSize<typename T::NativeType>(divisor_exp);
|
||||||
assert(divisor > T(0)); /// This is for Clang Static Analyzer. It is not smart enough to infer it automatically.
|
assert(divisor > 0); /// This is for Clang Static Analyzer. It is not smart enough to infer it automatically.
|
||||||
x.value /= divisor;
|
x.value /= divisor;
|
||||||
scale = 0;
|
scale = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -362,7 +362,9 @@ AggregatedDataVariants::Type Aggregator::chooseAggregationMethod()
|
|||||||
return AggregatedDataVariants::Type::key64;
|
return AggregatedDataVariants::Type::key64;
|
||||||
if (size_of_field == 16)
|
if (size_of_field == 16)
|
||||||
return AggregatedDataVariants::Type::keys128;
|
return AggregatedDataVariants::Type::keys128;
|
||||||
throw Exception("Logical error: numeric column has sizeOfField not in 1, 2, 4, 8, 16.", ErrorCodes::LOGICAL_ERROR);
|
if (size_of_field == 32)
|
||||||
|
return AggregatedDataVariants::Type::keys256;
|
||||||
|
throw Exception("Logical error: numeric column has sizeOfField not in 1, 2, 4, 8, 16, 32.", ErrorCodes::LOGICAL_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If all keys fits in N bits, will use hash table with all keys packed (placed contiguously) to single N-bit key.
|
/// If all keys fits in N bits, will use hash table with all keys packed (placed contiguously) to single N-bit key.
|
||||||
|
@ -221,7 +221,9 @@ HashJoin::Type HashJoin::chooseMethod(const ColumnRawPtrs & key_columns, Sizes &
|
|||||||
return Type::key64;
|
return Type::key64;
|
||||||
if (size_of_field == 16)
|
if (size_of_field == 16)
|
||||||
return Type::keys128;
|
return Type::keys128;
|
||||||
throw Exception("Logical error: numeric column has sizeOfField not in 1, 2, 4, 8, 16.", ErrorCodes::LOGICAL_ERROR);
|
if (size_of_field == 32)
|
||||||
|
return Type::keys256;
|
||||||
|
throw Exception("Logical error: numeric column has sizeOfField not in 1, 2, 4, 8, 16, 32.", ErrorCodes::LOGICAL_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If the keys fit in N bits, we will use a hash table for N-bit-packed keys
|
/// If the keys fit in N bits, we will use a hash table for N-bit-packed keys
|
||||||
|
@ -110,9 +110,8 @@ typename SetVariantsTemplate<Variant>::Type SetVariantsTemplate<Variant>::choose
|
|||||||
size_t size_of_field = nested_key_columns[0]->sizeOfValueIfFixed();
|
size_t size_of_field = nested_key_columns[0]->sizeOfValueIfFixed();
|
||||||
if ((size_of_field == 1) || (size_of_field == 2) || (size_of_field == 4) || (size_of_field == 8))
|
if ((size_of_field == 1) || (size_of_field == 2) || (size_of_field == 4) || (size_of_field == 8))
|
||||||
return Type::nullable_keys128;
|
return Type::nullable_keys128;
|
||||||
else
|
|
||||||
throw Exception{"Logical error: numeric column has sizeOfField not in 1, 2, 4, 8.",
|
/// Pass to more generic method
|
||||||
ErrorCodes::LOGICAL_ERROR};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (all_fixed)
|
if (all_fixed)
|
||||||
@ -145,7 +144,9 @@ typename SetVariantsTemplate<Variant>::Type SetVariantsTemplate<Variant>::choose
|
|||||||
return Type::key64;
|
return Type::key64;
|
||||||
if (size_of_field == 16)
|
if (size_of_field == 16)
|
||||||
return Type::keys128;
|
return Type::keys128;
|
||||||
throw Exception("Logical error: numeric column has sizeOfField not in 1, 2, 4, 8, 16.", ErrorCodes::LOGICAL_ERROR);
|
if (size_of_field == 32)
|
||||||
|
return Type::keys256;
|
||||||
|
throw Exception("Logical error: numeric column has sizeOfField not in 1, 2, 4, 8, 16, 32.", ErrorCodes::LOGICAL_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If the keys fit in N bits, we will use a hash table for N-bit-packed keys
|
/// If the keys fit in N bits, we will use a hash table for N-bit-packed keys
|
||||||
|
638
tests/queries/0_stateless/01440_big_int_shift.reference
Normal file
638
tests/queries/0_stateless/01440_big_int_shift.reference
Normal file
@ -0,0 +1,638 @@
|
|||||||
|
1 1 Int128 Int128
|
||||||
|
2 1 Int128 Int128
|
||||||
|
4 1 Int128 Int128
|
||||||
|
8 1 Int128 Int128
|
||||||
|
16 1 Int128 Int128
|
||||||
|
32 1 Int128 Int128
|
||||||
|
64 1 Int128 Int128
|
||||||
|
128 1 Int128 Int128
|
||||||
|
256 1 Int128 Int128
|
||||||
|
512 1 Int128 Int128
|
||||||
|
1024 1 Int128 Int128
|
||||||
|
2048 1 Int128 Int128
|
||||||
|
4096 1 Int128 Int128
|
||||||
|
8192 1 Int128 Int128
|
||||||
|
16384 1 Int128 Int128
|
||||||
|
32768 1 Int128 Int128
|
||||||
|
65536 1 Int128 Int128
|
||||||
|
131072 1 Int128 Int128
|
||||||
|
262144 1 Int128 Int128
|
||||||
|
524288 1 Int128 Int128
|
||||||
|
1048576 1 Int128 Int128
|
||||||
|
2097152 1 Int128 Int128
|
||||||
|
4194304 1 Int128 Int128
|
||||||
|
8388608 1 Int128 Int128
|
||||||
|
16777216 1 Int128 Int128
|
||||||
|
33554432 1 Int128 Int128
|
||||||
|
67108864 1 Int128 Int128
|
||||||
|
134217728 1 Int128 Int128
|
||||||
|
268435456 1 Int128 Int128
|
||||||
|
536870912 1 Int128 Int128
|
||||||
|
1073741824 1 Int128 Int128
|
||||||
|
2147483648 1 Int128 Int128
|
||||||
|
4294967296 1 Int128 Int128
|
||||||
|
8589934592 1 Int128 Int128
|
||||||
|
17179869184 1 Int128 Int128
|
||||||
|
34359738368 1 Int128 Int128
|
||||||
|
68719476736 1 Int128 Int128
|
||||||
|
137438953472 1 Int128 Int128
|
||||||
|
274877906944 1 Int128 Int128
|
||||||
|
549755813888 1 Int128 Int128
|
||||||
|
1099511627776 1 Int128 Int128
|
||||||
|
2199023255552 1 Int128 Int128
|
||||||
|
4398046511104 1 Int128 Int128
|
||||||
|
8796093022208 1 Int128 Int128
|
||||||
|
17592186044416 1 Int128 Int128
|
||||||
|
35184372088832 1 Int128 Int128
|
||||||
|
70368744177664 1 Int128 Int128
|
||||||
|
140737488355328 1 Int128 Int128
|
||||||
|
281474976710656 1 Int128 Int128
|
||||||
|
562949953421312 1 Int128 Int128
|
||||||
|
1125899906842624 1 Int128 Int128
|
||||||
|
2251799813685248 1 Int128 Int128
|
||||||
|
4503599627370496 1 Int128 Int128
|
||||||
|
9007199254740992 1 Int128 Int128
|
||||||
|
18014398509481984 1 Int128 Int128
|
||||||
|
36028797018963968 1 Int128 Int128
|
||||||
|
72057594037927936 1 Int128 Int128
|
||||||
|
144115188075855872 1 Int128 Int128
|
||||||
|
288230376151711744 1 Int128 Int128
|
||||||
|
576460752303423488 1 Int128 Int128
|
||||||
|
1152921504606846976 1 Int128 Int128
|
||||||
|
2305843009213693952 1 Int128 Int128
|
||||||
|
4611686018427387904 1 Int128 Int128
|
||||||
|
9223372036854775808 1 Int128 Int128
|
||||||
|
18446744073709551616 1 Int128 Int128
|
||||||
|
36893488147419103232 1 Int128 Int128
|
||||||
|
73786976294838206464 1 Int128 Int128
|
||||||
|
147573952589676412928 1 Int128 Int128
|
||||||
|
295147905179352825856 1 Int128 Int128
|
||||||
|
590295810358705651712 1 Int128 Int128
|
||||||
|
1180591620717411303424 1 Int128 Int128
|
||||||
|
2361183241434822606848 1 Int128 Int128
|
||||||
|
4722366482869645213696 1 Int128 Int128
|
||||||
|
9444732965739290427392 1 Int128 Int128
|
||||||
|
18889465931478580854784 1 Int128 Int128
|
||||||
|
37778931862957161709568 1 Int128 Int128
|
||||||
|
75557863725914323419136 1 Int128 Int128
|
||||||
|
151115727451828646838272 1 Int128 Int128
|
||||||
|
302231454903657293676544 1 Int128 Int128
|
||||||
|
604462909807314587353088 1 Int128 Int128
|
||||||
|
1208925819614629174706176 1 Int128 Int128
|
||||||
|
2417851639229258349412352 1 Int128 Int128
|
||||||
|
4835703278458516698824704 1 Int128 Int128
|
||||||
|
9671406556917033397649408 1 Int128 Int128
|
||||||
|
19342813113834066795298816 1 Int128 Int128
|
||||||
|
38685626227668133590597632 1 Int128 Int128
|
||||||
|
77371252455336267181195264 1 Int128 Int128
|
||||||
|
154742504910672534362390528 1 Int128 Int128
|
||||||
|
309485009821345068724781056 1 Int128 Int128
|
||||||
|
618970019642690137449562112 1 Int128 Int128
|
||||||
|
1237940039285380274899124224 1 Int128 Int128
|
||||||
|
2475880078570760549798248448 1 Int128 Int128
|
||||||
|
4951760157141521099596496896 1 Int128 Int128
|
||||||
|
9903520314283042199192993792 1 Int128 Int128
|
||||||
|
19807040628566084398385987584 1 Int128 Int128
|
||||||
|
39614081257132168796771975168 1 Int128 Int128
|
||||||
|
79228162514264337593543950336 1 Int128 Int128
|
||||||
|
158456325028528675187087900672 1 Int128 Int128
|
||||||
|
316912650057057350374175801344 1 Int128 Int128
|
||||||
|
633825300114114700748351602688 1 Int128 Int128
|
||||||
|
1267650600228229401496703205376 1 Int128 Int128
|
||||||
|
2535301200456458802993406410752 1 Int128 Int128
|
||||||
|
5070602400912917605986812821504 1 Int128 Int128
|
||||||
|
10141204801825835211973625643008 1 Int128 Int128
|
||||||
|
20282409603651670423947251286016 1 Int128 Int128
|
||||||
|
40564819207303340847894502572032 1 Int128 Int128
|
||||||
|
81129638414606681695789005144064 1 Int128 Int128
|
||||||
|
162259276829213363391578010288128 1 Int128 Int128
|
||||||
|
324518553658426726783156020576256 1 Int128 Int128
|
||||||
|
649037107316853453566312041152512 1 Int128 Int128
|
||||||
|
1298074214633706907132624082305024 1 Int128 Int128
|
||||||
|
2596148429267413814265248164610048 1 Int128 Int128
|
||||||
|
5192296858534827628530496329220096 1 Int128 Int128
|
||||||
|
10384593717069655257060992658440192 1 Int128 Int128
|
||||||
|
20769187434139310514121985316880384 1 Int128 Int128
|
||||||
|
41538374868278621028243970633760768 1 Int128 Int128
|
||||||
|
83076749736557242056487941267521536 1 Int128 Int128
|
||||||
|
166153499473114484112975882535043072 1 Int128 Int128
|
||||||
|
332306998946228968225951765070086144 1 Int128 Int128
|
||||||
|
664613997892457936451903530140172288 1 Int128 Int128
|
||||||
|
1329227995784915872903807060280344576 1 Int128 Int128
|
||||||
|
2658455991569831745807614120560689152 1 Int128 Int128
|
||||||
|
5316911983139663491615228241121378304 1 Int128 Int128
|
||||||
|
10633823966279326983230456482242756608 1 Int128 Int128
|
||||||
|
21267647932558653966460912964485513216 1 Int128 Int128
|
||||||
|
42535295865117307932921825928971026432 1 Int128 Int128
|
||||||
|
85070591730234615865843651857942052864 1 Int128 Int128
|
||||||
|
1 1 Int256 Int256
|
||||||
|
2 1 Int256 Int256
|
||||||
|
4 1 Int256 Int256
|
||||||
|
8 1 Int256 Int256
|
||||||
|
16 1 Int256 Int256
|
||||||
|
32 1 Int256 Int256
|
||||||
|
64 1 Int256 Int256
|
||||||
|
128 1 Int256 Int256
|
||||||
|
256 1 Int256 Int256
|
||||||
|
512 1 Int256 Int256
|
||||||
|
1024 1 Int256 Int256
|
||||||
|
2048 1 Int256 Int256
|
||||||
|
4096 1 Int256 Int256
|
||||||
|
8192 1 Int256 Int256
|
||||||
|
16384 1 Int256 Int256
|
||||||
|
32768 1 Int256 Int256
|
||||||
|
65536 1 Int256 Int256
|
||||||
|
131072 1 Int256 Int256
|
||||||
|
262144 1 Int256 Int256
|
||||||
|
524288 1 Int256 Int256
|
||||||
|
1048576 1 Int256 Int256
|
||||||
|
2097152 1 Int256 Int256
|
||||||
|
4194304 1 Int256 Int256
|
||||||
|
8388608 1 Int256 Int256
|
||||||
|
16777216 1 Int256 Int256
|
||||||
|
33554432 1 Int256 Int256
|
||||||
|
67108864 1 Int256 Int256
|
||||||
|
134217728 1 Int256 Int256
|
||||||
|
268435456 1 Int256 Int256
|
||||||
|
536870912 1 Int256 Int256
|
||||||
|
1073741824 1 Int256 Int256
|
||||||
|
2147483648 1 Int256 Int256
|
||||||
|
4294967296 1 Int256 Int256
|
||||||
|
8589934592 1 Int256 Int256
|
||||||
|
17179869184 1 Int256 Int256
|
||||||
|
34359738368 1 Int256 Int256
|
||||||
|
68719476736 1 Int256 Int256
|
||||||
|
137438953472 1 Int256 Int256
|
||||||
|
274877906944 1 Int256 Int256
|
||||||
|
549755813888 1 Int256 Int256
|
||||||
|
1099511627776 1 Int256 Int256
|
||||||
|
2199023255552 1 Int256 Int256
|
||||||
|
4398046511104 1 Int256 Int256
|
||||||
|
8796093022208 1 Int256 Int256
|
||||||
|
17592186044416 1 Int256 Int256
|
||||||
|
35184372088832 1 Int256 Int256
|
||||||
|
70368744177664 1 Int256 Int256
|
||||||
|
140737488355328 1 Int256 Int256
|
||||||
|
281474976710656 1 Int256 Int256
|
||||||
|
562949953421312 1 Int256 Int256
|
||||||
|
1125899906842624 1 Int256 Int256
|
||||||
|
2251799813685248 1 Int256 Int256
|
||||||
|
4503599627370496 1 Int256 Int256
|
||||||
|
9007199254740992 1 Int256 Int256
|
||||||
|
18014398509481984 1 Int256 Int256
|
||||||
|
36028797018963968 1 Int256 Int256
|
||||||
|
72057594037927936 1 Int256 Int256
|
||||||
|
144115188075855872 1 Int256 Int256
|
||||||
|
288230376151711744 1 Int256 Int256
|
||||||
|
576460752303423488 1 Int256 Int256
|
||||||
|
1152921504606846976 1 Int256 Int256
|
||||||
|
2305843009213693952 1 Int256 Int256
|
||||||
|
4611686018427387904 1 Int256 Int256
|
||||||
|
9223372036854775808 1 Int256 Int256
|
||||||
|
18446744073709551616 1 Int256 Int256
|
||||||
|
36893488147419103232 1 Int256 Int256
|
||||||
|
73786976294838206464 1 Int256 Int256
|
||||||
|
147573952589676412928 1 Int256 Int256
|
||||||
|
295147905179352825856 1 Int256 Int256
|
||||||
|
590295810358705651712 1 Int256 Int256
|
||||||
|
1180591620717411303424 1 Int256 Int256
|
||||||
|
2361183241434822606848 1 Int256 Int256
|
||||||
|
4722366482869645213696 1 Int256 Int256
|
||||||
|
9444732965739290427392 1 Int256 Int256
|
||||||
|
18889465931478580854784 1 Int256 Int256
|
||||||
|
37778931862957161709568 1 Int256 Int256
|
||||||
|
75557863725914323419136 1 Int256 Int256
|
||||||
|
151115727451828646838272 1 Int256 Int256
|
||||||
|
302231454903657293676544 1 Int256 Int256
|
||||||
|
604462909807314587353088 1 Int256 Int256
|
||||||
|
1208925819614629174706176 1 Int256 Int256
|
||||||
|
2417851639229258349412352 1 Int256 Int256
|
||||||
|
4835703278458516698824704 1 Int256 Int256
|
||||||
|
9671406556917033397649408 1 Int256 Int256
|
||||||
|
19342813113834066795298816 1 Int256 Int256
|
||||||
|
38685626227668133590597632 1 Int256 Int256
|
||||||
|
77371252455336267181195264 1 Int256 Int256
|
||||||
|
154742504910672534362390528 1 Int256 Int256
|
||||||
|
309485009821345068724781056 1 Int256 Int256
|
||||||
|
618970019642690137449562112 1 Int256 Int256
|
||||||
|
1237940039285380274899124224 1 Int256 Int256
|
||||||
|
2475880078570760549798248448 1 Int256 Int256
|
||||||
|
4951760157141521099596496896 1 Int256 Int256
|
||||||
|
9903520314283042199192993792 1 Int256 Int256
|
||||||
|
19807040628566084398385987584 1 Int256 Int256
|
||||||
|
39614081257132168796771975168 1 Int256 Int256
|
||||||
|
79228162514264337593543950336 1 Int256 Int256
|
||||||
|
158456325028528675187087900672 1 Int256 Int256
|
||||||
|
316912650057057350374175801344 1 Int256 Int256
|
||||||
|
633825300114114700748351602688 1 Int256 Int256
|
||||||
|
1267650600228229401496703205376 1 Int256 Int256
|
||||||
|
2535301200456458802993406410752 1 Int256 Int256
|
||||||
|
5070602400912917605986812821504 1 Int256 Int256
|
||||||
|
10141204801825835211973625643008 1 Int256 Int256
|
||||||
|
20282409603651670423947251286016 1 Int256 Int256
|
||||||
|
40564819207303340847894502572032 1 Int256 Int256
|
||||||
|
81129638414606681695789005144064 1 Int256 Int256
|
||||||
|
162259276829213363391578010288128 1 Int256 Int256
|
||||||
|
324518553658426726783156020576256 1 Int256 Int256
|
||||||
|
649037107316853453566312041152512 1 Int256 Int256
|
||||||
|
1298074214633706907132624082305024 1 Int256 Int256
|
||||||
|
2596148429267413814265248164610048 1 Int256 Int256
|
||||||
|
5192296858534827628530496329220096 1 Int256 Int256
|
||||||
|
10384593717069655257060992658440192 1 Int256 Int256
|
||||||
|
20769187434139310514121985316880384 1 Int256 Int256
|
||||||
|
41538374868278621028243970633760768 1 Int256 Int256
|
||||||
|
83076749736557242056487941267521536 1 Int256 Int256
|
||||||
|
166153499473114484112975882535043072 1 Int256 Int256
|
||||||
|
332306998946228968225951765070086144 1 Int256 Int256
|
||||||
|
664613997892457936451903530140172288 1 Int256 Int256
|
||||||
|
1329227995784915872903807060280344576 1 Int256 Int256
|
||||||
|
2658455991569831745807614120560689152 1 Int256 Int256
|
||||||
|
5316911983139663491615228241121378304 1 Int256 Int256
|
||||||
|
10633823966279326983230456482242756608 1 Int256 Int256
|
||||||
|
21267647932558653966460912964485513216 1 Int256 Int256
|
||||||
|
42535295865117307932921825928971026432 1 Int256 Int256
|
||||||
|
85070591730234615865843651857942052864 1 Int256 Int256
|
||||||
|
170141183460469231731687303715884105728 1 Int256 Int256
|
||||||
|
340282366920938463463374607431768211456 1 Int256 Int256
|
||||||
|
680564733841876926926749214863536422912 1 Int256 Int256
|
||||||
|
1361129467683753853853498429727072845824 1 Int256 Int256
|
||||||
|
2722258935367507707706996859454145691648 1 Int256 Int256
|
||||||
|
5444517870735015415413993718908291383296 1 Int256 Int256
|
||||||
|
10889035741470030830827987437816582766592 1 Int256 Int256
|
||||||
|
21778071482940061661655974875633165533184 1 Int256 Int256
|
||||||
|
43556142965880123323311949751266331066368 1 Int256 Int256
|
||||||
|
87112285931760246646623899502532662132736 1 Int256 Int256
|
||||||
|
174224571863520493293247799005065324265472 1 Int256 Int256
|
||||||
|
348449143727040986586495598010130648530944 1 Int256 Int256
|
||||||
|
696898287454081973172991196020261297061888 1 Int256 Int256
|
||||||
|
1393796574908163946345982392040522594123776 1 Int256 Int256
|
||||||
|
2787593149816327892691964784081045188247552 1 Int256 Int256
|
||||||
|
5575186299632655785383929568162090376495104 1 Int256 Int256
|
||||||
|
11150372599265311570767859136324180752990208 1 Int256 Int256
|
||||||
|
22300745198530623141535718272648361505980416 1 Int256 Int256
|
||||||
|
44601490397061246283071436545296723011960832 1 Int256 Int256
|
||||||
|
89202980794122492566142873090593446023921664 1 Int256 Int256
|
||||||
|
178405961588244985132285746181186892047843328 1 Int256 Int256
|
||||||
|
356811923176489970264571492362373784095686656 1 Int256 Int256
|
||||||
|
713623846352979940529142984724747568191373312 1 Int256 Int256
|
||||||
|
1427247692705959881058285969449495136382746624 1 Int256 Int256
|
||||||
|
2854495385411919762116571938898990272765493248 1 Int256 Int256
|
||||||
|
5708990770823839524233143877797980545530986496 1 Int256 Int256
|
||||||
|
11417981541647679048466287755595961091061972992 1 Int256 Int256
|
||||||
|
22835963083295358096932575511191922182123945984 1 Int256 Int256
|
||||||
|
45671926166590716193865151022383844364247891968 1 Int256 Int256
|
||||||
|
91343852333181432387730302044767688728495783936 1 Int256 Int256
|
||||||
|
182687704666362864775460604089535377456991567872 1 Int256 Int256
|
||||||
|
365375409332725729550921208179070754913983135744 1 Int256 Int256
|
||||||
|
730750818665451459101842416358141509827966271488 1 Int256 Int256
|
||||||
|
1461501637330902918203684832716283019655932542976 1 Int256 Int256
|
||||||
|
2923003274661805836407369665432566039311865085952 1 Int256 Int256
|
||||||
|
5846006549323611672814739330865132078623730171904 1 Int256 Int256
|
||||||
|
11692013098647223345629478661730264157247460343808 1 Int256 Int256
|
||||||
|
23384026197294446691258957323460528314494920687616 1 Int256 Int256
|
||||||
|
46768052394588893382517914646921056628989841375232 1 Int256 Int256
|
||||||
|
93536104789177786765035829293842113257979682750464 1 Int256 Int256
|
||||||
|
187072209578355573530071658587684226515959365500928 1 Int256 Int256
|
||||||
|
374144419156711147060143317175368453031918731001856 1 Int256 Int256
|
||||||
|
748288838313422294120286634350736906063837462003712 1 Int256 Int256
|
||||||
|
1496577676626844588240573268701473812127674924007424 1 Int256 Int256
|
||||||
|
2993155353253689176481146537402947624255349848014848 1 Int256 Int256
|
||||||
|
5986310706507378352962293074805895248510699696029696 1 Int256 Int256
|
||||||
|
11972621413014756705924586149611790497021399392059392 1 Int256 Int256
|
||||||
|
23945242826029513411849172299223580994042798784118784 1 Int256 Int256
|
||||||
|
47890485652059026823698344598447161988085597568237568 1 Int256 Int256
|
||||||
|
95780971304118053647396689196894323976171195136475136 1 Int256 Int256
|
||||||
|
191561942608236107294793378393788647952342390272950272 1 Int256 Int256
|
||||||
|
383123885216472214589586756787577295904684780545900544 1 Int256 Int256
|
||||||
|
766247770432944429179173513575154591809369561091801088 1 Int256 Int256
|
||||||
|
1532495540865888858358347027150309183618739122183602176 1 Int256 Int256
|
||||||
|
3064991081731777716716694054300618367237478244367204352 1 Int256 Int256
|
||||||
|
6129982163463555433433388108601236734474956488734408704 1 Int256 Int256
|
||||||
|
12259964326927110866866776217202473468949912977468817408 1 Int256 Int256
|
||||||
|
24519928653854221733733552434404946937899825954937634816 1 Int256 Int256
|
||||||
|
49039857307708443467467104868809893875799651909875269632 1 Int256 Int256
|
||||||
|
98079714615416886934934209737619787751599303819750539264 1 Int256 Int256
|
||||||
|
196159429230833773869868419475239575503198607639501078528 1 Int256 Int256
|
||||||
|
392318858461667547739736838950479151006397215279002157056 1 Int256 Int256
|
||||||
|
784637716923335095479473677900958302012794430558004314112 1 Int256 Int256
|
||||||
|
1569275433846670190958947355801916604025588861116008628224 1 Int256 Int256
|
||||||
|
3138550867693340381917894711603833208051177722232017256448 1 Int256 Int256
|
||||||
|
6277101735386680763835789423207666416102355444464034512896 1 Int256 Int256
|
||||||
|
12554203470773361527671578846415332832204710888928069025792 1 Int256 Int256
|
||||||
|
25108406941546723055343157692830665664409421777856138051584 1 Int256 Int256
|
||||||
|
50216813883093446110686315385661331328818843555712276103168 1 Int256 Int256
|
||||||
|
100433627766186892221372630771322662657637687111424552206336 1 Int256 Int256
|
||||||
|
200867255532373784442745261542645325315275374222849104412672 1 Int256 Int256
|
||||||
|
401734511064747568885490523085290650630550748445698208825344 1 Int256 Int256
|
||||||
|
803469022129495137770981046170581301261101496891396417650688 1 Int256 Int256
|
||||||
|
1606938044258990275541962092341162602522202993782792835301376 1 Int256 Int256
|
||||||
|
3213876088517980551083924184682325205044405987565585670602752 1 Int256 Int256
|
||||||
|
6427752177035961102167848369364650410088811975131171341205504 1 Int256 Int256
|
||||||
|
12855504354071922204335696738729300820177623950262342682411008 1 Int256 Int256
|
||||||
|
25711008708143844408671393477458601640355247900524685364822016 1 Int256 Int256
|
||||||
|
51422017416287688817342786954917203280710495801049370729644032 1 Int256 Int256
|
||||||
|
102844034832575377634685573909834406561420991602098741459288064 1 Int256 Int256
|
||||||
|
205688069665150755269371147819668813122841983204197482918576128 1 Int256 Int256
|
||||||
|
411376139330301510538742295639337626245683966408394965837152256 1 Int256 Int256
|
||||||
|
822752278660603021077484591278675252491367932816789931674304512 1 Int256 Int256
|
||||||
|
1645504557321206042154969182557350504982735865633579863348609024 1 Int256 Int256
|
||||||
|
3291009114642412084309938365114701009965471731267159726697218048 1 Int256 Int256
|
||||||
|
6582018229284824168619876730229402019930943462534319453394436096 1 Int256 Int256
|
||||||
|
13164036458569648337239753460458804039861886925068638906788872192 1 Int256 Int256
|
||||||
|
26328072917139296674479506920917608079723773850137277813577744384 1 Int256 Int256
|
||||||
|
52656145834278593348959013841835216159447547700274555627155488768 1 Int256 Int256
|
||||||
|
105312291668557186697918027683670432318895095400549111254310977536 1 Int256 Int256
|
||||||
|
210624583337114373395836055367340864637790190801098222508621955072 1 Int256 Int256
|
||||||
|
421249166674228746791672110734681729275580381602196445017243910144 1 Int256 Int256
|
||||||
|
842498333348457493583344221469363458551160763204392890034487820288 1 Int256 Int256
|
||||||
|
1684996666696914987166688442938726917102321526408785780068975640576 1 Int256 Int256
|
||||||
|
3369993333393829974333376885877453834204643052817571560137951281152 1 Int256 Int256
|
||||||
|
6739986666787659948666753771754907668409286105635143120275902562304 1 Int256 Int256
|
||||||
|
13479973333575319897333507543509815336818572211270286240551805124608 1 Int256 Int256
|
||||||
|
26959946667150639794667015087019630673637144422540572481103610249216 1 Int256 Int256
|
||||||
|
53919893334301279589334030174039261347274288845081144962207220498432 1 Int256 Int256
|
||||||
|
107839786668602559178668060348078522694548577690162289924414440996864 1 Int256 Int256
|
||||||
|
215679573337205118357336120696157045389097155380324579848828881993728 1 Int256 Int256
|
||||||
|
431359146674410236714672241392314090778194310760649159697657763987456 1 Int256 Int256
|
||||||
|
862718293348820473429344482784628181556388621521298319395315527974912 1 Int256 Int256
|
||||||
|
1725436586697640946858688965569256363112777243042596638790631055949824 1 Int256 Int256
|
||||||
|
3450873173395281893717377931138512726225554486085193277581262111899648 1 Int256 Int256
|
||||||
|
6901746346790563787434755862277025452451108972170386555162524223799296 1 Int256 Int256
|
||||||
|
13803492693581127574869511724554050904902217944340773110325048447598592 1 Int256 Int256
|
||||||
|
27606985387162255149739023449108101809804435888681546220650096895197184 1 Int256 Int256
|
||||||
|
55213970774324510299478046898216203619608871777363092441300193790394368 1 Int256 Int256
|
||||||
|
110427941548649020598956093796432407239217743554726184882600387580788736 1 Int256 Int256
|
||||||
|
220855883097298041197912187592864814478435487109452369765200775161577472 1 Int256 Int256
|
||||||
|
441711766194596082395824375185729628956870974218904739530401550323154944 1 Int256 Int256
|
||||||
|
883423532389192164791648750371459257913741948437809479060803100646309888 1 Int256 Int256
|
||||||
|
1766847064778384329583297500742918515827483896875618958121606201292619776 1 Int256 Int256
|
||||||
|
3533694129556768659166595001485837031654967793751237916243212402585239552 1 Int256 Int256
|
||||||
|
7067388259113537318333190002971674063309935587502475832486424805170479104 1 Int256 Int256
|
||||||
|
14134776518227074636666380005943348126619871175004951664972849610340958208 1 Int256 Int256
|
||||||
|
28269553036454149273332760011886696253239742350009903329945699220681916416 1 Int256 Int256
|
||||||
|
56539106072908298546665520023773392506479484700019806659891398441363832832 1 Int256 Int256
|
||||||
|
113078212145816597093331040047546785012958969400039613319782796882727665664 1 Int256 Int256
|
||||||
|
226156424291633194186662080095093570025917938800079226639565593765455331328 1 Int256 Int256
|
||||||
|
452312848583266388373324160190187140051835877600158453279131187530910662656 1 Int256 Int256
|
||||||
|
904625697166532776746648320380374280103671755200316906558262375061821325312 1 Int256 Int256
|
||||||
|
1809251394333065553493296640760748560207343510400633813116524750123642650624 1 Int256 Int256
|
||||||
|
3618502788666131106986593281521497120414687020801267626233049500247285301248 1 Int256 Int256
|
||||||
|
7237005577332262213973186563042994240829374041602535252466099000494570602496 1 Int256 Int256
|
||||||
|
14474011154664524427946373126085988481658748083205070504932198000989141204992 1 Int256 Int256
|
||||||
|
28948022309329048855892746252171976963317496166410141009864396001978282409984 1 Int256 Int256
|
||||||
|
1 1 UInt256 UInt256
|
||||||
|
2 1 UInt256 UInt256
|
||||||
|
4 1 UInt256 UInt256
|
||||||
|
8 1 UInt256 UInt256
|
||||||
|
16 1 UInt256 UInt256
|
||||||
|
32 1 UInt256 UInt256
|
||||||
|
64 1 UInt256 UInt256
|
||||||
|
128 1 UInt256 UInt256
|
||||||
|
256 1 UInt256 UInt256
|
||||||
|
512 1 UInt256 UInt256
|
||||||
|
1024 1 UInt256 UInt256
|
||||||
|
2048 1 UInt256 UInt256
|
||||||
|
4096 1 UInt256 UInt256
|
||||||
|
8192 1 UInt256 UInt256
|
||||||
|
16384 1 UInt256 UInt256
|
||||||
|
32768 1 UInt256 UInt256
|
||||||
|
65536 1 UInt256 UInt256
|
||||||
|
131072 1 UInt256 UInt256
|
||||||
|
262144 1 UInt256 UInt256
|
||||||
|
524288 1 UInt256 UInt256
|
||||||
|
1048576 1 UInt256 UInt256
|
||||||
|
2097152 1 UInt256 UInt256
|
||||||
|
4194304 1 UInt256 UInt256
|
||||||
|
8388608 1 UInt256 UInt256
|
||||||
|
16777216 1 UInt256 UInt256
|
||||||
|
33554432 1 UInt256 UInt256
|
||||||
|
67108864 1 UInt256 UInt256
|
||||||
|
134217728 1 UInt256 UInt256
|
||||||
|
268435456 1 UInt256 UInt256
|
||||||
|
536870912 1 UInt256 UInt256
|
||||||
|
1073741824 1 UInt256 UInt256
|
||||||
|
2147483648 1 UInt256 UInt256
|
||||||
|
4294967296 1 UInt256 UInt256
|
||||||
|
8589934592 1 UInt256 UInt256
|
||||||
|
17179869184 1 UInt256 UInt256
|
||||||
|
34359738368 1 UInt256 UInt256
|
||||||
|
68719476736 1 UInt256 UInt256
|
||||||
|
137438953472 1 UInt256 UInt256
|
||||||
|
274877906944 1 UInt256 UInt256
|
||||||
|
549755813888 1 UInt256 UInt256
|
||||||
|
1099511627776 1 UInt256 UInt256
|
||||||
|
2199023255552 1 UInt256 UInt256
|
||||||
|
4398046511104 1 UInt256 UInt256
|
||||||
|
8796093022208 1 UInt256 UInt256
|
||||||
|
17592186044416 1 UInt256 UInt256
|
||||||
|
35184372088832 1 UInt256 UInt256
|
||||||
|
70368744177664 1 UInt256 UInt256
|
||||||
|
140737488355328 1 UInt256 UInt256
|
||||||
|
281474976710656 1 UInt256 UInt256
|
||||||
|
562949953421312 1 UInt256 UInt256
|
||||||
|
1125899906842624 1 UInt256 UInt256
|
||||||
|
2251799813685248 1 UInt256 UInt256
|
||||||
|
4503599627370496 1 UInt256 UInt256
|
||||||
|
9007199254740992 1 UInt256 UInt256
|
||||||
|
18014398509481984 1 UInt256 UInt256
|
||||||
|
36028797018963968 1 UInt256 UInt256
|
||||||
|
72057594037927936 1 UInt256 UInt256
|
||||||
|
144115188075855872 1 UInt256 UInt256
|
||||||
|
288230376151711744 1 UInt256 UInt256
|
||||||
|
576460752303423488 1 UInt256 UInt256
|
||||||
|
1152921504606846976 1 UInt256 UInt256
|
||||||
|
2305843009213693952 1 UInt256 UInt256
|
||||||
|
4611686018427387904 1 UInt256 UInt256
|
||||||
|
9223372036854775808 1 UInt256 UInt256
|
||||||
|
18446744073709551616 1 UInt256 UInt256
|
||||||
|
36893488147419103232 1 UInt256 UInt256
|
||||||
|
73786976294838206464 1 UInt256 UInt256
|
||||||
|
147573952589676412928 1 UInt256 UInt256
|
||||||
|
295147905179352825856 1 UInt256 UInt256
|
||||||
|
590295810358705651712 1 UInt256 UInt256
|
||||||
|
1180591620717411303424 1 UInt256 UInt256
|
||||||
|
2361183241434822606848 1 UInt256 UInt256
|
||||||
|
4722366482869645213696 1 UInt256 UInt256
|
||||||
|
9444732965739290427392 1 UInt256 UInt256
|
||||||
|
18889465931478580854784 1 UInt256 UInt256
|
||||||
|
37778931862957161709568 1 UInt256 UInt256
|
||||||
|
75557863725914323419136 1 UInt256 UInt256
|
||||||
|
151115727451828646838272 1 UInt256 UInt256
|
||||||
|
302231454903657293676544 1 UInt256 UInt256
|
||||||
|
604462909807314587353088 1 UInt256 UInt256
|
||||||
|
1208925819614629174706176 1 UInt256 UInt256
|
||||||
|
2417851639229258349412352 1 UInt256 UInt256
|
||||||
|
4835703278458516698824704 1 UInt256 UInt256
|
||||||
|
9671406556917033397649408 1 UInt256 UInt256
|
||||||
|
19342813113834066795298816 1 UInt256 UInt256
|
||||||
|
38685626227668133590597632 1 UInt256 UInt256
|
||||||
|
77371252455336267181195264 1 UInt256 UInt256
|
||||||
|
154742504910672534362390528 1 UInt256 UInt256
|
||||||
|
309485009821345068724781056 1 UInt256 UInt256
|
||||||
|
618970019642690137449562112 1 UInt256 UInt256
|
||||||
|
1237940039285380274899124224 1 UInt256 UInt256
|
||||||
|
2475880078570760549798248448 1 UInt256 UInt256
|
||||||
|
4951760157141521099596496896 1 UInt256 UInt256
|
||||||
|
9903520314283042199192993792 1 UInt256 UInt256
|
||||||
|
19807040628566084398385987584 1 UInt256 UInt256
|
||||||
|
39614081257132168796771975168 1 UInt256 UInt256
|
||||||
|
79228162514264337593543950336 1 UInt256 UInt256
|
||||||
|
158456325028528675187087900672 1 UInt256 UInt256
|
||||||
|
316912650057057350374175801344 1 UInt256 UInt256
|
||||||
|
633825300114114700748351602688 1 UInt256 UInt256
|
||||||
|
1267650600228229401496703205376 1 UInt256 UInt256
|
||||||
|
2535301200456458802993406410752 1 UInt256 UInt256
|
||||||
|
5070602400912917605986812821504 1 UInt256 UInt256
|
||||||
|
10141204801825835211973625643008 1 UInt256 UInt256
|
||||||
|
20282409603651670423947251286016 1 UInt256 UInt256
|
||||||
|
40564819207303340847894502572032 1 UInt256 UInt256
|
||||||
|
81129638414606681695789005144064 1 UInt256 UInt256
|
||||||
|
162259276829213363391578010288128 1 UInt256 UInt256
|
||||||
|
324518553658426726783156020576256 1 UInt256 UInt256
|
||||||
|
649037107316853453566312041152512 1 UInt256 UInt256
|
||||||
|
1298074214633706907132624082305024 1 UInt256 UInt256
|
||||||
|
2596148429267413814265248164610048 1 UInt256 UInt256
|
||||||
|
5192296858534827628530496329220096 1 UInt256 UInt256
|
||||||
|
10384593717069655257060992658440192 1 UInt256 UInt256
|
||||||
|
20769187434139310514121985316880384 1 UInt256 UInt256
|
||||||
|
41538374868278621028243970633760768 1 UInt256 UInt256
|
||||||
|
83076749736557242056487941267521536 1 UInt256 UInt256
|
||||||
|
166153499473114484112975882535043072 1 UInt256 UInt256
|
||||||
|
332306998946228968225951765070086144 1 UInt256 UInt256
|
||||||
|
664613997892457936451903530140172288 1 UInt256 UInt256
|
||||||
|
1329227995784915872903807060280344576 1 UInt256 UInt256
|
||||||
|
2658455991569831745807614120560689152 1 UInt256 UInt256
|
||||||
|
5316911983139663491615228241121378304 1 UInt256 UInt256
|
||||||
|
10633823966279326983230456482242756608 1 UInt256 UInt256
|
||||||
|
21267647932558653966460912964485513216 1 UInt256 UInt256
|
||||||
|
42535295865117307932921825928971026432 1 UInt256 UInt256
|
||||||
|
85070591730234615865843651857942052864 1 UInt256 UInt256
|
||||||
|
170141183460469231731687303715884105728 1 UInt256 UInt256
|
||||||
|
340282366920938463463374607431768211456 1 UInt256 UInt256
|
||||||
|
680564733841876926926749214863536422912 1 UInt256 UInt256
|
||||||
|
1361129467683753853853498429727072845824 1 UInt256 UInt256
|
||||||
|
2722258935367507707706996859454145691648 1 UInt256 UInt256
|
||||||
|
5444517870735015415413993718908291383296 1 UInt256 UInt256
|
||||||
|
10889035741470030830827987437816582766592 1 UInt256 UInt256
|
||||||
|
21778071482940061661655974875633165533184 1 UInt256 UInt256
|
||||||
|
43556142965880123323311949751266331066368 1 UInt256 UInt256
|
||||||
|
87112285931760246646623899502532662132736 1 UInt256 UInt256
|
||||||
|
174224571863520493293247799005065324265472 1 UInt256 UInt256
|
||||||
|
348449143727040986586495598010130648530944 1 UInt256 UInt256
|
||||||
|
696898287454081973172991196020261297061888 1 UInt256 UInt256
|
||||||
|
1393796574908163946345982392040522594123776 1 UInt256 UInt256
|
||||||
|
2787593149816327892691964784081045188247552 1 UInt256 UInt256
|
||||||
|
5575186299632655785383929568162090376495104 1 UInt256 UInt256
|
||||||
|
11150372599265311570767859136324180752990208 1 UInt256 UInt256
|
||||||
|
22300745198530623141535718272648361505980416 1 UInt256 UInt256
|
||||||
|
44601490397061246283071436545296723011960832 1 UInt256 UInt256
|
||||||
|
89202980794122492566142873090593446023921664 1 UInt256 UInt256
|
||||||
|
178405961588244985132285746181186892047843328 1 UInt256 UInt256
|
||||||
|
356811923176489970264571492362373784095686656 1 UInt256 UInt256
|
||||||
|
713623846352979940529142984724747568191373312 1 UInt256 UInt256
|
||||||
|
1427247692705959881058285969449495136382746624 1 UInt256 UInt256
|
||||||
|
2854495385411919762116571938898990272765493248 1 UInt256 UInt256
|
||||||
|
5708990770823839524233143877797980545530986496 1 UInt256 UInt256
|
||||||
|
11417981541647679048466287755595961091061972992 1 UInt256 UInt256
|
||||||
|
22835963083295358096932575511191922182123945984 1 UInt256 UInt256
|
||||||
|
45671926166590716193865151022383844364247891968 1 UInt256 UInt256
|
||||||
|
91343852333181432387730302044767688728495783936 1 UInt256 UInt256
|
||||||
|
182687704666362864775460604089535377456991567872 1 UInt256 UInt256
|
||||||
|
365375409332725729550921208179070754913983135744 1 UInt256 UInt256
|
||||||
|
730750818665451459101842416358141509827966271488 1 UInt256 UInt256
|
||||||
|
1461501637330902918203684832716283019655932542976 1 UInt256 UInt256
|
||||||
|
2923003274661805836407369665432566039311865085952 1 UInt256 UInt256
|
||||||
|
5846006549323611672814739330865132078623730171904 1 UInt256 UInt256
|
||||||
|
11692013098647223345629478661730264157247460343808 1 UInt256 UInt256
|
||||||
|
23384026197294446691258957323460528314494920687616 1 UInt256 UInt256
|
||||||
|
46768052394588893382517914646921056628989841375232 1 UInt256 UInt256
|
||||||
|
93536104789177786765035829293842113257979682750464 1 UInt256 UInt256
|
||||||
|
187072209578355573530071658587684226515959365500928 1 UInt256 UInt256
|
||||||
|
374144419156711147060143317175368453031918731001856 1 UInt256 UInt256
|
||||||
|
748288838313422294120286634350736906063837462003712 1 UInt256 UInt256
|
||||||
|
1496577676626844588240573268701473812127674924007424 1 UInt256 UInt256
|
||||||
|
2993155353253689176481146537402947624255349848014848 1 UInt256 UInt256
|
||||||
|
5986310706507378352962293074805895248510699696029696 1 UInt256 UInt256
|
||||||
|
11972621413014756705924586149611790497021399392059392 1 UInt256 UInt256
|
||||||
|
23945242826029513411849172299223580994042798784118784 1 UInt256 UInt256
|
||||||
|
47890485652059026823698344598447161988085597568237568 1 UInt256 UInt256
|
||||||
|
95780971304118053647396689196894323976171195136475136 1 UInt256 UInt256
|
||||||
|
191561942608236107294793378393788647952342390272950272 1 UInt256 UInt256
|
||||||
|
383123885216472214589586756787577295904684780545900544 1 UInt256 UInt256
|
||||||
|
766247770432944429179173513575154591809369561091801088 1 UInt256 UInt256
|
||||||
|
1532495540865888858358347027150309183618739122183602176 1 UInt256 UInt256
|
||||||
|
3064991081731777716716694054300618367237478244367204352 1 UInt256 UInt256
|
||||||
|
6129982163463555433433388108601236734474956488734408704 1 UInt256 UInt256
|
||||||
|
12259964326927110866866776217202473468949912977468817408 1 UInt256 UInt256
|
||||||
|
24519928653854221733733552434404946937899825954937634816 1 UInt256 UInt256
|
||||||
|
49039857307708443467467104868809893875799651909875269632 1 UInt256 UInt256
|
||||||
|
98079714615416886934934209737619787751599303819750539264 1 UInt256 UInt256
|
||||||
|
196159429230833773869868419475239575503198607639501078528 1 UInt256 UInt256
|
||||||
|
392318858461667547739736838950479151006397215279002157056 1 UInt256 UInt256
|
||||||
|
784637716923335095479473677900958302012794430558004314112 1 UInt256 UInt256
|
||||||
|
1569275433846670190958947355801916604025588861116008628224 1 UInt256 UInt256
|
||||||
|
3138550867693340381917894711603833208051177722232017256448 1 UInt256 UInt256
|
||||||
|
6277101735386680763835789423207666416102355444464034512896 1 UInt256 UInt256
|
||||||
|
12554203470773361527671578846415332832204710888928069025792 1 UInt256 UInt256
|
||||||
|
25108406941546723055343157692830665664409421777856138051584 1 UInt256 UInt256
|
||||||
|
50216813883093446110686315385661331328818843555712276103168 1 UInt256 UInt256
|
||||||
|
100433627766186892221372630771322662657637687111424552206336 1 UInt256 UInt256
|
||||||
|
200867255532373784442745261542645325315275374222849104412672 1 UInt256 UInt256
|
||||||
|
401734511064747568885490523085290650630550748445698208825344 1 UInt256 UInt256
|
||||||
|
803469022129495137770981046170581301261101496891396417650688 1 UInt256 UInt256
|
||||||
|
1606938044258990275541962092341162602522202993782792835301376 1 UInt256 UInt256
|
||||||
|
3213876088517980551083924184682325205044405987565585670602752 1 UInt256 UInt256
|
||||||
|
6427752177035961102167848369364650410088811975131171341205504 1 UInt256 UInt256
|
||||||
|
12855504354071922204335696738729300820177623950262342682411008 1 UInt256 UInt256
|
||||||
|
25711008708143844408671393477458601640355247900524685364822016 1 UInt256 UInt256
|
||||||
|
51422017416287688817342786954917203280710495801049370729644032 1 UInt256 UInt256
|
||||||
|
102844034832575377634685573909834406561420991602098741459288064 1 UInt256 UInt256
|
||||||
|
205688069665150755269371147819668813122841983204197482918576128 1 UInt256 UInt256
|
||||||
|
411376139330301510538742295639337626245683966408394965837152256 1 UInt256 UInt256
|
||||||
|
822752278660603021077484591278675252491367932816789931674304512 1 UInt256 UInt256
|
||||||
|
1645504557321206042154969182557350504982735865633579863348609024 1 UInt256 UInt256
|
||||||
|
3291009114642412084309938365114701009965471731267159726697218048 1 UInt256 UInt256
|
||||||
|
6582018229284824168619876730229402019930943462534319453394436096 1 UInt256 UInt256
|
||||||
|
13164036458569648337239753460458804039861886925068638906788872192 1 UInt256 UInt256
|
||||||
|
26328072917139296674479506920917608079723773850137277813577744384 1 UInt256 UInt256
|
||||||
|
52656145834278593348959013841835216159447547700274555627155488768 1 UInt256 UInt256
|
||||||
|
105312291668557186697918027683670432318895095400549111254310977536 1 UInt256 UInt256
|
||||||
|
210624583337114373395836055367340864637790190801098222508621955072 1 UInt256 UInt256
|
||||||
|
421249166674228746791672110734681729275580381602196445017243910144 1 UInt256 UInt256
|
||||||
|
842498333348457493583344221469363458551160763204392890034487820288 1 UInt256 UInt256
|
||||||
|
1684996666696914987166688442938726917102321526408785780068975640576 1 UInt256 UInt256
|
||||||
|
3369993333393829974333376885877453834204643052817571560137951281152 1 UInt256 UInt256
|
||||||
|
6739986666787659948666753771754907668409286105635143120275902562304 1 UInt256 UInt256
|
||||||
|
13479973333575319897333507543509815336818572211270286240551805124608 1 UInt256 UInt256
|
||||||
|
26959946667150639794667015087019630673637144422540572481103610249216 1 UInt256 UInt256
|
||||||
|
53919893334301279589334030174039261347274288845081144962207220498432 1 UInt256 UInt256
|
||||||
|
107839786668602559178668060348078522694548577690162289924414440996864 1 UInt256 UInt256
|
||||||
|
215679573337205118357336120696157045389097155380324579848828881993728 1 UInt256 UInt256
|
||||||
|
431359146674410236714672241392314090778194310760649159697657763987456 1 UInt256 UInt256
|
||||||
|
862718293348820473429344482784628181556388621521298319395315527974912 1 UInt256 UInt256
|
||||||
|
1725436586697640946858688965569256363112777243042596638790631055949824 1 UInt256 UInt256
|
||||||
|
3450873173395281893717377931138512726225554486085193277581262111899648 1 UInt256 UInt256
|
||||||
|
6901746346790563787434755862277025452451108972170386555162524223799296 1 UInt256 UInt256
|
||||||
|
13803492693581127574869511724554050904902217944340773110325048447598592 1 UInt256 UInt256
|
||||||
|
27606985387162255149739023449108101809804435888681546220650096895197184 1 UInt256 UInt256
|
||||||
|
55213970774324510299478046898216203619608871777363092441300193790394368 1 UInt256 UInt256
|
||||||
|
110427941548649020598956093796432407239217743554726184882600387580788736 1 UInt256 UInt256
|
||||||
|
220855883097298041197912187592864814478435487109452369765200775161577472 1 UInt256 UInt256
|
||||||
|
441711766194596082395824375185729628956870974218904739530401550323154944 1 UInt256 UInt256
|
||||||
|
883423532389192164791648750371459257913741948437809479060803100646309888 1 UInt256 UInt256
|
||||||
|
1766847064778384329583297500742918515827483896875618958121606201292619776 1 UInt256 UInt256
|
||||||
|
3533694129556768659166595001485837031654967793751237916243212402585239552 1 UInt256 UInt256
|
||||||
|
7067388259113537318333190002971674063309935587502475832486424805170479104 1 UInt256 UInt256
|
||||||
|
14134776518227074636666380005943348126619871175004951664972849610340958208 1 UInt256 UInt256
|
||||||
|
28269553036454149273332760011886696253239742350009903329945699220681916416 1 UInt256 UInt256
|
||||||
|
56539106072908298546665520023773392506479484700019806659891398441363832832 1 UInt256 UInt256
|
||||||
|
113078212145816597093331040047546785012958969400039613319782796882727665664 1 UInt256 UInt256
|
||||||
|
226156424291633194186662080095093570025917938800079226639565593765455331328 1 UInt256 UInt256
|
||||||
|
452312848583266388373324160190187140051835877600158453279131187530910662656 1 UInt256 UInt256
|
||||||
|
904625697166532776746648320380374280103671755200316906558262375061821325312 1 UInt256 UInt256
|
||||||
|
1809251394333065553493296640760748560207343510400633813116524750123642650624 1 UInt256 UInt256
|
||||||
|
3618502788666131106986593281521497120414687020801267626233049500247285301248 1 UInt256 UInt256
|
||||||
|
7237005577332262213973186563042994240829374041602535252466099000494570602496 1 UInt256 UInt256
|
||||||
|
14474011154664524427946373126085988481658748083205070504932198000989141204992 1 UInt256 UInt256
|
||||||
|
28948022309329048855892746252171976963317496166410141009864396001978282409984 1 UInt256 UInt256
|
||||||
|
57896044618658097711785492504343953926634992332820282019728792003956564819968 1 UInt256 UInt256
|
3
tests/queries/0_stateless/01440_big_int_shift.sql
Normal file
3
tests/queries/0_stateless/01440_big_int_shift.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
SELECT bitShiftLeft(toInt128(1), number) x, bitShiftRight(x, number) y, toTypeName(x), toTypeName(y) FROM numbers(127) ORDER BY number;
|
||||||
|
SELECT bitShiftLeft(toInt256(1), number) x, bitShiftRight(x, number) y, toTypeName(x), toTypeName(y) FROM numbers(255) ORDER BY number;
|
||||||
|
SELECT bitShiftLeft(toUInt256(1), number) x, bitShiftRight(x, number) y, toTypeName(x), toTypeName(y) FROM numbers(256) ORDER BY number;
|
24
tests/queries/0_stateless/01457_int256_hashing.reference
Normal file
24
tests/queries/0_stateless/01457_int256_hashing.reference
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
0
|
||||||
|
123
|
||||||
|
123
|
||||||
|
[1,1,2]
|
||||||
|
0
|
||||||
|
123
|
||||||
|
123
|
||||||
|
[1,1,2]
|
||||||
|
0
|
||||||
|
123
|
||||||
|
123
|
||||||
|
[1,1,2]
|
||||||
|
0
|
||||||
|
321
|
||||||
|
321
|
||||||
|
[1,1,2]
|
||||||
|
0
|
||||||
|
321
|
||||||
|
321
|
||||||
|
[1,1,2]
|
||||||
|
0
|
||||||
|
321
|
||||||
|
321
|
||||||
|
[1,1,2]
|
39
tests/queries/0_stateless/01457_int256_hashing.sql
Normal file
39
tests/queries/0_stateless/01457_int256_hashing.sql
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
SELECT toUInt256(123) IN (NULL);
|
||||||
|
SELECT toUInt256(123) AS k GROUP BY k;
|
||||||
|
SELECT toUInt256(123) AS k FROM system.one INNER JOIN (SELECT toUInt256(123) AS k) t USING k;
|
||||||
|
SELECT arrayEnumerateUniq([toUInt256(123), toUInt256(456), toUInt256(123)]);
|
||||||
|
|
||||||
|
SELECT toInt256(123) IN (NULL);
|
||||||
|
SELECT toInt256(123) AS k GROUP BY k;
|
||||||
|
SELECT toInt256(123) AS k FROM system.one INNER JOIN (SELECT toInt256(123) AS k) t USING k;
|
||||||
|
SELECT arrayEnumerateUniq([toInt256(123), toInt256(456), toInt256(123)]);
|
||||||
|
|
||||||
|
-- SELECT toUInt128(123) IN (NULL);
|
||||||
|
-- SELECT toUInt128(123) AS k GROUP BY k;
|
||||||
|
-- SELECT toUInt128(123) AS k FROM system.one INNER JOIN (SELECT toUInt128(123) AS k) t USING k;
|
||||||
|
-- SELECT arrayEnumerateUniq([toUInt128(123), toUInt128(456), toUInt128(123)]);
|
||||||
|
|
||||||
|
SELECT toInt128(123) IN (NULL);
|
||||||
|
SELECT toInt128(123) AS k GROUP BY k;
|
||||||
|
SELECT toInt128(123) AS k FROM system.one INNER JOIN (SELECT toInt128(123) AS k) t USING k;
|
||||||
|
SELECT arrayEnumerateUniq([toInt128(123), toInt128(456), toInt128(123)]);
|
||||||
|
|
||||||
|
SELECT toNullable(toUInt256(321)) IN (NULL);
|
||||||
|
SELECT toNullable(toUInt256(321)) AS k GROUP BY k;
|
||||||
|
SELECT toNullable(toUInt256(321)) AS k FROM system.one INNER JOIN (SELECT toUInt256(321) AS k) t USING k;
|
||||||
|
SELECT arrayEnumerateUniq([toNullable(toUInt256(321)), toNullable(toUInt256(456)), toNullable(toUInt256(321))]);
|
||||||
|
|
||||||
|
SELECT toNullable(toInt256(321)) IN (NULL);
|
||||||
|
SELECT toNullable(toInt256(321)) AS k GROUP BY k;
|
||||||
|
SELECT toNullable(toInt256(321)) AS k FROM system.one INNER JOIN (SELECT toInt256(321) AS k) t USING k;
|
||||||
|
SELECT arrayEnumerateUniq([toNullable(toInt256(321)), toNullable(toInt256(456)), toNullable(toInt256(321))]);
|
||||||
|
|
||||||
|
-- SELECT toNullable(toUInt128(321)) IN (NULL);
|
||||||
|
-- SELECT toNullable(toUInt128(321)) AS k GROUP BY k;
|
||||||
|
-- SELECT toNullable(toUInt128(321)) AS k FROM system.one INNER JOIN (SELECT toUInt128(321) AS k) t USING k;
|
||||||
|
-- SELECT arrayEnumerateUniq([toNullable(toUInt128(321)), toNullable(toUInt128(456)), toNullable(toUInt128(321))]);
|
||||||
|
|
||||||
|
SELECT toNullable(toInt128(321)) IN (NULL);
|
||||||
|
SELECT toNullable(toInt128(321)) AS k GROUP BY k;
|
||||||
|
SELECT toNullable(toInt128(321)) AS k FROM system.one INNER JOIN (SELECT toInt128(321) AS k) t USING k;
|
||||||
|
SELECT arrayEnumerateUniq([toNullable(toInt128(321)), toNullable(toInt128(456)), toNullable(toInt128(321))]);
|
Loading…
Reference in New Issue
Block a user