summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKirill Burtsev <kirill.burtsev@qt.io>2018-10-12 17:40:09 +0200
committerKirill Burtsev <kirill.burtsev@qt.io>2018-10-18 17:37:14 +0000
commit57b09b903e015bb192c2d1a0a1eb0fa308483c9c (patch)
treebc86b2863243d0c358c1e6cdeb4e36dcaf5ed46a
parent96218681f22588b93999626684ec73717207bb39 (diff)
Fix QString latin1 conversion and comparison for -optimize-size build
Change-Id: I5f0ae946151e9733cbe21cb24387636ba68bc177 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r--src/corelib/tools/qstring.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 5a2d6b228d..c89635cfdb 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<MaxTailLength>::exec(e - uc, 0, lambda, lambda);
# endif