Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qhash.cpp File Reference

(3ccb4ce781463f1b8e0cb4c9283b3067fe92a32e)

#include <stdlib.h>
#include <stdint.h>
#include "qhash.h"
#include <qbitarray.h>
#include <qstring.h>
#include <qglobal.h>
#include <qbytearray.h>
#include <qdatetime.h>
#include <qbasicatomic.h>
#include <qendian.h>
#include <private/qrandom_p.h>
#include <private/qsimd_p.h>
#include <qcoreapplication.h>
#include <qrandom.h>
#include <private/qlocale_tools_p.h>
#include "../../3rdparty/siphash/siphash.cpp"
#include <array>
#include <limits.h>
#include <assert.h>
+ Include dependency graph for qhash.cpp:

Go to the source code of this file.

Macros

#define _CRT_RAND_S
 
#define Q_DECL_HOT_FUNCTION
 

Enumerations

enum  ZeroExtension { None = 0 , ByteToWord = 1 , None = 0 , ByteToWord = 1 }
 
enum  ZeroExtension { None = 0 , ByteToWord = 1 , None = 0 , ByteToWord = 1 }
 

Functions

QT_BEGIN_NAMESPACE void qt_from_latin1 (char16_t *dst, const char *str, size_t size) noexcept
 
Q_NEVER_INLINE static Q_DECL_HOT_FUNCTION uint64_t murmurhash (const void *key, uint64_t len, uint64_t seed) noexcept
 
template<ZeroExtension = None>
static size_t qHashBits_fallback (const uchar *p, size_t size, size_t seed, size_t seed2) noexcept
 
template<>
size_t qHashBits_fallback< None > (const uchar *p, size_t size, size_t seed, size_t seed2) noexcept
 
template<>
size_t qHashBits_fallback< ByteToWord > (const uchar *data, size_t size, size_t seed, size_t seed2) noexcept
 
size_t qHashBits (const void *p, size_t size, size_t seed) noexcept
 
size_t qHash (QByteArrayView key, size_t seed) noexcept
 
size_t qHash (QStringView key, size_t seed) noexcept
 
size_t qHash (const QBitArray &bitArray, size_t seed=0)
 
size_t qHash (QLatin1StringView key, size_t seed) noexcept
 
uint qt_hash (QStringView key, uint chained) noexcept
 
template<>
size_t qHashBits_fallback< None > (const uchar *p, size_t size, size_t seed, size_t seed2) noexcept
 
template<>
size_t qHashBits_fallback< ByteToWord > (const uchar *data, size_t size, size_t seed, size_t seed2) noexcept
 

Variables

static Q_CONSTINIT HashSeedStorage qt_qhash_seed
 

Macro Definition Documentation

◆ _CRT_RAND_S

#define _CRT_RAND_S

Definition at line 9 of file qhash.cpp.

◆ Q_DECL_HOT_FUNCTION

#define Q_DECL_HOT_FUNCTION

Definition at line 50 of file qhash.cpp.

Enumeration Type Documentation

◆ ZeroExtension [1/2]

Enumerator
None 
ByteToWord 
None 
ByteToWord 

Definition at line 291 of file qhash.cpp.

◆ ZeroExtension [2/2]

Enumerator
None 
ByteToWord 
None 
ByteToWord 

Definition at line 291 of file qhash.cpp.

Function Documentation

◆ murmurhash()

Q_NEVER_INLINE static Q_DECL_HOT_FUNCTION uint64_t murmurhash ( const void * key,
uint64_t len,
uint64_t seed )
inlinestaticnoexcept

Definition at line 243 of file qhash.cpp.

◆ qHash() [1/4]

size_t qHash ( const QBitArray & bitArray,
size_t seed = 0 )
related

Definition at line 886 of file qhash.cpp.

◆ qHash() [2/4]

size_t qHash ( QByteArrayView key,
size_t seed )
noexcept

Definition at line 875 of file qhash.cpp.

◆ qHash() [3/4]

size_t qHash ( QLatin1StringView key,
size_t seed )
related

Definition at line 900 of file qhash.cpp.

◆ qHash() [4/4]

size_t qHash ( QStringView key,
size_t seed )
related

Definition at line 880 of file qhash.cpp.

◆ qHashBits()

size_t qHashBits ( const void * p,
size_t size,
size_t seed )
related

Definition at line 850 of file qhash.cpp.

◆ qHashBits_fallback()

template<ZeroExtension = None>
static size_t qHashBits_fallback ( const uchar * p,
size_t size,
size_t seed,
size_t seed2 )
staticnoexcept

◆ qHashBits_fallback< ByteToWord >() [1/2]

template<>
size_t qHashBits_fallback< ByteToWord > ( const uchar * data,
size_t size,
size_t seed,
size_t seed2 )
noexcept

Definition at line 306 of file qhash.cpp.

◆ qHashBits_fallback< ByteToWord >() [2/2]

template<>
size_t qHashBits_fallback< ByteToWord > ( const uchar * data,
size_t size,
size_t seed,
size_t seed2 )
noexcept

Definition at line 306 of file qhash.cpp.

◆ qHashBits_fallback< None >() [1/2]

template<>
size_t qHashBits_fallback< None > ( const uchar * p,
size_t size,
size_t seed,
size_t seed2 )
noexcept

Definition at line 298 of file qhash.cpp.

◆ qHashBits_fallback< None >() [2/2]

template<>
size_t qHashBits_fallback< None > ( const uchar * p,
size_t size,
size_t seed,
size_t seed2 )
noexcept

Definition at line 298 of file qhash.cpp.

◆ qt_from_latin1()

QT_BEGIN_NAMESPACE void qt_from_latin1 ( char16_t * dst,
const char * str,
size_t size )
noexcept

Definition at line 920 of file qstring.cpp.

◆ qt_hash()

uint qt_hash ( QStringView key,
uint chained )
noexcept

Private copy of the implementation of the Qt 4 qHash algorithm for strings, (that is, QChar-based arrays, so all QString-like classes), to be used wherever the result is somehow stored or reused across multiple Qt versions. The public qHash implementation can change at any time, therefore one must not rely on the fact that it will always give the same results.

The qt_hash functions must never change their results.

This function can hash discontiguous memory by invoking it on each chunk, passing the previous's result in the next call's chained argument.

Definition at line 1086 of file qhash.cpp.

Variable Documentation

◆ qt_qhash_seed

static Q_CONSTINIT HashSeedStorage qt_qhash_seed
static

Definition at line 177 of file qhash.cpp.