From edeeb801c09dc6fbc348a60bfe5af591516b9797 Mon Sep 17 00:00:00 2001 From: Maksim Kita Date: Tue, 3 Aug 2021 21:46:25 +0300 Subject: [PATCH] Updated readIntTextUnsafe --- src/IO/ReadHelpers.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/IO/ReadHelpers.h b/src/IO/ReadHelpers.h index d8e31c18617..e9055a43660 100644 --- a/src/IO/ReadHelpers.h +++ b/src/IO/ReadHelpers.h @@ -403,7 +403,6 @@ bool tryReadIntText(T & x, ReadBuffer & buf) // -V1071 * Differs in following: * - for numbers starting with zero, parsed only zero; * - symbol '+' before number is not supported; - * - symbols :;<=>? are parsed as some numbers. */ template void readIntTextUnsafe(T & x, ReadBuffer & buf) @@ -437,15 +436,12 @@ void readIntTextUnsafe(T & x, ReadBuffer & buf) while (!buf.eof()) { - /// This check is suddenly faster than - /// unsigned char c = *buf.position() - '0'; - /// if (c < 10) - /// for unknown reason on Xeon E5645. + auto value = *buf.position() - '0'; - if ((*buf.position() & 0xF0) == 0x30) /// It makes sense to have this condition inside loop. + if (value < 10) { res *= 10; - res += *buf.position() & 0x0F; + res += value; ++buf.position(); } else