summaryrefslogtreecommitdiffstats
path: root/src/corelib/codecs
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-06-05 22:26:44 +0200
committerJ-P Nurmi <jpnurmi@digia.com>2014-06-05 22:26:44 +0200
commit0fcce50af009f97efa2a5c5f2c74415c92830962 (patch)
treef8abf0e4f445fed9480b426b2f856b50911f1210 /src/corelib/codecs
parent74d46a669badc5bf32187686102ca4e644a3c0af (diff)
parentc54f7720d09e7d00f3309736bbeaaa6a81967ec1 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: mkspecs/features/qt.prf src/plugins/platforms/xcb/qxcbwindow.h src/tools/qdoc/qdocindexfiles.cpp src/widgets/kernel/qwidget_qpa.cpp Change-Id: I214f57b03bc2ff86cf3b7dfe2966168af93a5a67
Diffstat (limited to 'src/corelib/codecs')
-rw-r--r--src/corelib/codecs/qutfcodec.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp
index f16144771f..9139e61700 100644
--- a/src/corelib/codecs/qutfcodec.cpp
+++ b/src/corelib/codecs/qutfcodec.cpp
@@ -74,25 +74,22 @@ static inline bool simdEncodeAscii(uchar *&dst, const ushort *&nextAscii, const
__m128i packed = _mm_packus_epi16(data1, data2);
__m128i nonAscii = _mm_cmpgt_epi8(packed, _mm_setzero_si128());
+ // store, even if there are non-ASCII characters here
+ _mm_storeu_si128((__m128i*)dst, packed);
+
// n will contain 1 bit set per character in [data1, data2] that is non-ASCII (or NUL)
ushort n = ~_mm_movemask_epi8(nonAscii);
if (n) {
- // copy the front part that is still ASCII
- while (!(n & 1)) {
- *dst++ = *src++;
- n >>= 1;
- }
-
// find the next probable ASCII character
// we don't want to load 32 bytes again in this loop if we know there are non-ASCII
// characters still coming
- n = _bit_scan_reverse(n);
- nextAscii = src + n + 1;
+ nextAscii = src + _bit_scan_reverse(n) + 1;
+
+ n = _bit_scan_forward(n);
+ dst += n;
+ src += n;
return false;
}
-
- // pack
- _mm_storeu_si128((__m128i*)dst, packed);
}
return src == end;
}