diff options
author | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2016-05-25 10:34:29 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-05-26 08:45:36 +0000 |
commit | 5904822b50f628734da66e27d85bd9a27c7d58ae (patch) | |
tree | 3ab2adb4c0d32ceefe675504436cb30654a8bd8b /src/corelib/json | |
parent | 2cf63c71ebe139890526057dcc51b24ea6df6c30 (diff) |
Squeeze more vectorized rounds out of JSON Latin1String conversion.
E.g. for a string of length 16, with i == 0, this loop can still run.
Same for the case where length is 8.
Change-Id: Ie95832b50ddeba2e0dfb0e3308e4c7a5376bb969
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/json')
-rw-r--r-- | src/corelib/json/qjson_p.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h index 5e34845fe3..d16b6e5b00 100644 --- a/src/corelib/json/qjson_p.h +++ b/src/corelib/json/qjson_p.h @@ -396,7 +396,7 @@ public: const ushort *uc = (const ushort *)str.unicode(); int i = 0; #ifdef __SSE2__ - for ( ; i + 16 < len; i += 16) { + for ( ; i + 16 <= len; i += 16) { __m128i chunk1 = _mm_loadu_si128((__m128i*)&uc[i]); // load __m128i chunk2 = _mm_loadu_si128((__m128i*)&uc[i + 8]); // load // pack the two vector to 16 x 8bits elements @@ -405,7 +405,7 @@ public: } # ifdef Q_PROCESSOR_X86_64 // we can do one more round, of 8 characters - if (i + 8 < len) { + if (i + 8 <= len) { __m128i chunk = _mm_loadu_si128((__m128i*)&uc[i]); // load // pack with itself, we'll discard the high part anyway chunk = _mm_packus_epi16(chunk, chunk); |