Merge pull request #513 from miloyip/optimization

Make whitespace array more compact
This commit is contained in:
Milo Yip 2016-01-22 20:13:58 +08:00
commit 968a666acd

View File

@ -314,11 +314,9 @@ inline const char *SkipWhitespace_SIMD(const char* p) {
return p; return p;
// The rest of string // The rest of string
static const char whitespaces[4][17] = { #define C16(c) { c, c, c, c, c, c, c, c, c, c, c, c, c, c, c, c }
" ", static const char whitespaces[4][16] = { C16(' '), C16('\n'), C16('\r'), C16('\t') };
"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", #undef C16
"\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r",
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"};
const __m128i w0 = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&whitespaces[0][0])); const __m128i w0 = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&whitespaces[0][0]));
const __m128i w1 = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&whitespaces[1][0])); const __m128i w1 = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&whitespaces[1][0]));