From 5904822b50f628734da66e27d85bd9a27c7d58ae Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 25 May 2016 10:34:29 +0200 Subject: 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 --- src/corelib/json/qjson_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') 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); -- cgit v1.2.3