From 57b09b903e015bb192c2d1a0a1eb0fa308483c9c Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Fri, 12 Oct 2018 17:40:09 +0200 Subject: [PATCH] Fix QString latin1 conversion and comparison for -optimize-size build Change-Id: I5f0ae946151e9733cbe21cb24387636ba68bc177 Reviewed-by: Edward Welbourne --- src/corelib/tools/qstring.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 5a2d6b228d5..c89635cfdb8 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -711,9 +711,15 @@ static void qt_to_latin1_internal(uchar *dst, const ushort *src, qsizetype lengt } length = length % 4; +# else + length = length % 16; +# endif // optimize size + + // advance dst, src for tail processing dst += offset; src += offset; +# if !defined(__OPTIMIZE_SIZE__) return UnrollTailLoop<3>::exec(length, [=](int i) { if (Checked) dst[i] = (src[i]>0xff) ? '?' : (uchar) src[i]; @@ -1072,11 +1078,13 @@ static int ucstrncmp(const QChar *a, const uchar *c, size_t l) // still matched offset += 4; } +# endif // optimize size // reset uc and c uc += offset; c += offset; +# if !defined(__OPTIMIZE_SIZE__) const auto lambda = [=](size_t i) { return uc[i] - ushort(c[i]); }; return UnrollTailLoop::exec(e - uc, 0, lambda, lambda); # endif