summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2021-08-30 09:32:30 -0700
committerThiago Macieira <thiago.macieira@intel.com>2021-09-01 11:32:03 -0700
commitf3743073a70086cfcf39a2daf2c605993ab25ce3 (patch)
treee8009fefede0d0ad30db95c7b27b6925df16eb28 /tests
parent9258c509363bf118c67cc11e7479e08819d4f566 (diff)
qstrnlen: micro-optimize further
This is the kind of loop that the autovectorizer is pretty good at, but this is really just a type of memchr, so help dumber compilers and build modes without vectorization. Drive-up fix the style of the test code. Change-Id: Ie72b0dd0fbe84d2caae0fffd16a022a35fa24c17 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
index a4798e77aa..0f1f00bf6c 100644
--- a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
@@ -803,18 +803,18 @@ void tst_QByteArray::qvsnprintf()
void tst_QByteArray::qstrlen()
{
const char *src = "Something about ... \0 a string.";
- QCOMPARE(::qstrlen((char*)0), (uint)0);
- QCOMPARE(::qstrlen(src), (uint)20);
+ QCOMPARE(::qstrlen(nullptr), size_t(0));
+ QCOMPARE(::qstrlen(src), size_t(20));
}
void tst_QByteArray::qstrnlen()
{
const char *src = "Something about ... \0 a string.";
- QCOMPARE(::qstrnlen((char*)0, 1), (uint)0);
- QCOMPARE(::qstrnlen(src, 31), (uint)20);
- QCOMPARE(::qstrnlen(src, 19), (uint)19);
- QCOMPARE(::qstrnlen(src, 21), (uint)20);
- QCOMPARE(::qstrnlen(src, 20), (uint)20);
+ QCOMPARE(::qstrnlen(nullptr, 1), size_t(0));
+ QCOMPARE(::qstrnlen(src, 31), size_t(20));
+ QCOMPARE(::qstrnlen(src, 19), size_t(19));
+ QCOMPARE(::qstrnlen(src, 21), size_t(20));
+ QCOMPARE(::qstrnlen(src, 20), size_t(20));
}
void tst_QByteArray::qstrcpy()