mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Slightly better
This commit is contained in:
parent
5e75bad82a
commit
12a0ef907e
@ -730,7 +730,7 @@ static const char digits100[201] =
|
||||
template <char delimiter = '-'>
|
||||
inline void writeDateText(const LocalDate & date, WriteBuffer & buf)
|
||||
{
|
||||
if (buf.position() && buf.position() + 10 <= buf.buffer().end())
|
||||
if (reinterpret_cast<intptr_t>(buf.position()) + 10 <= reinterpret_cast<intptr_t>(buf.buffer().end()))
|
||||
{
|
||||
memcpy(buf.position(), &digits100[date.year() / 100 * 2], 2);
|
||||
buf.position() += 2;
|
||||
@ -767,7 +767,7 @@ inline void writeDateText(DayNum date, WriteBuffer & buf)
|
||||
template <char date_delimeter = '-', char time_delimeter = ':', char between_date_time_delimiter = ' '>
|
||||
inline void writeDateTimeText(const LocalDateTime & datetime, WriteBuffer & buf)
|
||||
{
|
||||
if (buf.position() && buf.position() + 19 <= buf.buffer().end())
|
||||
if (reinterpret_cast<intptr_t>(buf.position()) + 19 <= reinterpret_cast<intptr_t>(buf.buffer().end()))
|
||||
{
|
||||
memcpy(buf.position(), &digits100[datetime.year() / 100 * 2], 2);
|
||||
buf.position() += 2;
|
||||
|
@ -24,7 +24,7 @@ namespace detail
|
||||
template <typename T>
|
||||
void writeIntText(T x, WriteBuffer & buf)
|
||||
{
|
||||
if (likely(buf.position() && buf.position() + WRITE_HELPERS_MAX_INT_WIDTH < buf.buffer().end()))
|
||||
if (likely(reinterpret_cast<intptr_t>(buf.position()) + WRITE_HELPERS_MAX_INT_WIDTH < reinterpret_cast<intptr_t>(buf.buffer().end())))
|
||||
buf.position() = itoa(x, buf.position());
|
||||
else
|
||||
detail::writeUIntTextFallback(x, buf);
|
||||
|
Loading…
Reference in New Issue
Block a user