summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/corelib/tools/qhash/outofline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks/corelib/tools/qhash/outofline.cpp')
-rw-r--r--tests/benchmarks/corelib/tools/qhash/outofline.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/benchmarks/corelib/tools/qhash/outofline.cpp b/tests/benchmarks/corelib/tools/qhash/outofline.cpp
index c8adc73da4..5b16c36ffb 100644
--- a/tests/benchmarks/corelib/tools/qhash/outofline.cpp
+++ b/tests/benchmarks/corelib/tools/qhash/outofline.cpp
@@ -1,13 +1,13 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "tst_bench_qhash.h"
QT_BEGIN_NAMESPACE
-uint qHash(const Qt4String &str)
+size_t qHash(const Qt4String &str, size_t /* never used */)
{
- int n = str.length();
+ qsizetype n = str.size();
const QChar *p = str.unicode();
uint h = 0;
@@ -19,11 +19,11 @@ uint qHash(const Qt4String &str)
return h;
}
-uint qHash(const Qt50String &key, uint seed)
+size_t qHash(const Qt50String &key, size_t seed)
{
const QChar *p = key.unicode();
- int len = key.size();
- uint h = seed;
+ qsizetype len = key.size();
+ size_t h = seed;
for (int i = 0; i < len; ++i)
h = 31 * h + p[i].unicode();
return h;
@@ -40,10 +40,10 @@ uint qHash(const Qt50String &key, uint seed)
// Still, we can avoid writing the multiplication as "(h << 5) - h"
// -- the compiler will turn it into a shift and an addition anyway
// (for instance, gcc 4.4 does that even at -O0).
-uint qHash(const JavaString &str)
+size_t qHash(const JavaString &str, size_t /* never used */)
{
- const unsigned short *p = (unsigned short *)str.constData();
- const int len = str.size();
+ const auto *p = reinterpret_cast<const char16_t *>(str.constData());
+ const qsizetype len = str.size();
uint h = 0;