mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
Fix error
This commit is contained in:
parent
8940677bf2
commit
fd4f214e43
@ -105,7 +105,7 @@ using UnsignedOfSize = typename SelectType
|
||||
uint16_t,
|
||||
uint32_t,
|
||||
uint64_t,
|
||||
UInt128
|
||||
__uint128_t
|
||||
>::Result;
|
||||
|
||||
/// Holds the result of dividing an unsigned N-byte variable by 10^N resulting in
|
||||
@ -349,6 +349,8 @@ static inline int digits10(T x)
|
||||
template <typename T>
|
||||
static inline char * writeUIntText(T x, char * p)
|
||||
{
|
||||
static_assert(is_unsigned_v<T>);
|
||||
|
||||
int len = digits10(x);
|
||||
auto pp = p + len;
|
||||
while (x >= 100)
|
||||
@ -418,25 +420,25 @@ inline char * itoa(char8_t i, char * p)
|
||||
}
|
||||
|
||||
template <>
|
||||
inline char * itoa<UInt128>(UInt128 i, char * p)
|
||||
inline char * itoa(UInt128 i, char * p)
|
||||
{
|
||||
return impl::writeUIntText(i, p);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline char * itoa<Int128>(Int128 i, char * p)
|
||||
inline char * itoa(Int128 i, char * p)
|
||||
{
|
||||
return impl::writeSIntText(i, p);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline char * itoa<UInt256>(UInt256 i, char * p)
|
||||
inline char * itoa(UInt256 i, char * p)
|
||||
{
|
||||
return impl::writeUIntText(i, p);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline char * itoa<Int256>(Int256 i, char * p)
|
||||
inline char * itoa(Int256 i, char * p)
|
||||
{
|
||||
return impl::writeSIntText(i, p);
|
||||
}
|
||||
|
@ -905,13 +905,11 @@ String decimalFractional(const T & x, UInt32 scale)
|
||||
{
|
||||
if constexpr (std::is_same_v<T, Int256>)
|
||||
{
|
||||
static constexpr Int128 max_int128 = (Int128(0x7fffffffffffffffll) << 64) + 0xffffffffffffffffll;
|
||||
|
||||
if (x <= std::numeric_limits<UInt32>::max())
|
||||
return decimalFractional(static_cast<UInt32>(x), scale);
|
||||
else if (x <= std::numeric_limits<UInt64>::max())
|
||||
return decimalFractional(static_cast<UInt64>(x), scale);
|
||||
else if (x <= max_int128)
|
||||
else if (x <= std::numeric_limits<UInt128>::max())
|
||||
return decimalFractional(static_cast<Int128>(x), scale);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, Int128>)
|
||||
|
@ -32,8 +32,8 @@ namespace detail
|
||||
void NO_INLINE writeUIntTextFallback(T x, WriteBuffer & buf)
|
||||
{
|
||||
char tmp[max_int_width<T>];
|
||||
int len = itoa(x, tmp) - tmp;
|
||||
buf.write(tmp, len);
|
||||
char * end = itoa(x, tmp);
|
||||
buf.write(tmp, end - tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user