summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qhash.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-02-12 14:10:35 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-28 21:27:41 +0100
commit12372960f8ab3c50231c4f5c21aa6a87c69e9915 (patch)
treed4aec4dbfb80f621e2f48c83dfa5a76e2ea7caf4 /src/corelib/tools/qhash.h
parentf4ffe2a2439928992c3f44085e81686d4f911417 (diff)
Add qHashBits(), a hash function for a memory block
The function arguments have been chosen to avoid caller-side casting of argument types, when passing object addresses and type sizeof()s. [ChangeLog][QtCore] Added qHashBits() to aid implementing qHash() overloads for custom types. Change-Id: I983a8560769bb27e489f23ebb6db51850ddd65f2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qhash.h')
-rw-r--r--src/corelib/tools/qhash.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index 409774a76d..4af2d4878e 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -60,6 +60,8 @@ class QString;
class QStringRef;
class QLatin1String;
+Q_CORE_EXPORT uint qHashBits(const void *p, size_t size, uint seed = 0) Q_DECL_NOTHROW;
+
inline uint qHash(char key, uint seed = 0) Q_DECL_NOTHROW { return uint(key) ^ seed; }
inline uint qHash(uchar key, uint seed = 0) Q_DECL_NOTHROW { return uint(key) ^ seed; }
inline uint qHash(signed char key, uint seed = 0) Q_DECL_NOTHROW { return uint(key) ^ seed; }