mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Addition to prev. revision [#METR-2944].
This commit is contained in:
parent
b4e18e2222
commit
6e1ec28840
@ -16,6 +16,24 @@ namespace DB
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
static inline UInt64 stringWidth(const UInt8 * pos, const UInt8 * end)
|
||||||
|
{
|
||||||
|
UInt64 res = 0;
|
||||||
|
for (; pos < end; ++pos)
|
||||||
|
{
|
||||||
|
if (*pos == '\b' || *pos == '\f' || *pos == '\n' || *pos == '\r' || *pos == '\t' || *pos == '\0' || *pos == '\'' || *pos == '\\')
|
||||||
|
++res;
|
||||||
|
if (*pos <= 0x7F || *pos >= 0xC0)
|
||||||
|
++res;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline UInt64 stringWidthConstant(const String & data)
|
||||||
|
{
|
||||||
|
return stringWidth(reinterpret_cast<const UInt8 *>(data.data()), reinterpret_cast<const UInt8 *>(data.data()) + data.size());
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static void numWidthVector(const PaddedPODArray<T> & a, PaddedPODArray<UInt64> & c)
|
static void numWidthVector(const PaddedPODArray<T> & a, PaddedPODArray<UInt64> & c)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user