#pragma once #include #include #include #include /// 40 digits or 39 digits and a sign #define WRITE_HELPERS_MAX_INT_WIDTH 40U namespace DB { namespace detail { template void NO_INLINE writeUIntTextFallback(T x, WriteBuffer & buf) { char tmp[WRITE_HELPERS_MAX_INT_WIDTH]; int len = itoa(x, tmp) - tmp; buf.write(tmp, len); } } template void writeIntText(T x, WriteBuffer & buf) { if (likely(buf.position() + WRITE_HELPERS_MAX_INT_WIDTH < buf.buffer().end())) buf.position() = itoa(x, buf.position()); else detail::writeUIntTextFallback(x, buf); } }