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, 16 insertions, 2 deletions
diff --git a/tests/benchmarks/corelib/tools/qhash/outofline.cpp b/tests/benchmarks/corelib/tools/qhash/outofline.cpp
index 162c604a35..8adaa0a04f 100644
--- a/tests/benchmarks/corelib/tools/qhash/outofline.cpp
+++ b/tests/benchmarks/corelib/tools/qhash/outofline.cpp
@@ -41,6 +41,22 @@
#include "main.h"
+QT_BEGIN_NAMESPACE
+
+uint qHash(const Qt4String &str)
+{
+ int n = str.length();
+ const QChar *p = str.unicode();
+ uint h = 0;
+
+ while (n--) {
+ h = (h << 4) + (*p++).unicode();
+ h ^= (h & 0xf0000000) >> 23;
+ h &= 0x0fffffff;
+ }
+ return h;
+}
+
static void doHash(const unsigned short *p, uint &h)
{
#if 1
@@ -67,8 +83,6 @@ static void doHash(const unsigned short *p, uint &h)
#endif
}
-QT_BEGIN_NAMESPACE
-
uint qHash(const String &str)
{
const unsigned short *p = (unsigned short *)str.constData();