UniqueHash Struct Reference

#include <hash.h>

Detailed Description

UniqueHash is used as return type of GetUniqueHashCode functions. It has a size of 128 bits. For reasonable hash code functions it's a practically safe assumption that there are no hash collisions, so one can consider such a hash to be unique.

Public Member Functions

 UniqueHash ()=default
constexpr UniqueHash (UInt64 l, UInt64 h)
Bool operator== (const UniqueHash &other) const
Bool operator!= (const UniqueHash &other) const
Bool operator< (const UniqueHash &other) const
HashInt GetHashCode () const
const UniqueHashGetUniqueHashCode () const
constexpr UInt operator& (UInt mask) const
void CombineUnordered (const UniqueHash &other)

Static Public Member Functions

static constexpr Bool TriviallyHashable ()
static UniqueHash GetUniqueHashCode (const Byte *ptr, Int count)
static UniqueHash GetUniqueHashCode (const Block< const Byte > &bytes)
template<typename... H>
static UniqueHash CombineHashes (const H &... hashes)

Public Attributes

UInt64 low
UInt64 high

Constructor & Destructor Documentation

◆ UniqueHash() [1/2]

UniqueHash ( )

◆ UniqueHash() [2/2]

constexpr UniqueHash ( UInt64  l,
UInt64  h 

Member Function Documentation

◆ TriviallyHashable()

static constexpr Bool TriviallyHashable ( )

◆ operator==()

Bool operator== ( const UniqueHash other) const

◆ operator!=()

Bool operator!= ( const UniqueHash other) const

◆ operator<()

Bool operator< ( const UniqueHash other) const



◆ GetHashCode()

HashInt GetHashCode ( ) const

◆ GetUniqueHashCode()

const UniqueHash& GetUniqueHashCode ( ) const

◆ operator&()

constexpr UInt operator& ( UInt  mask) const

Returns the bitwise and of the low bits of this UniqueHash and the given mask.

[in]maskA bit mask.
Bitwise and of low bits and mask.

◆ CombineUnordered()

void CombineUnordered ( const UniqueHash other)

Combines the other UniqueHash with this UniqueHash in an unordered way, which means that the effect of multiple calls to CombineUnordered doesn't depend on the order of those calls. You can use this function to compute a UniqueHash of a sequence of UniqueHashes when the sequence order shall be irrelevant.

[in]otherAnother UniqueHash.

◆ CombineHashes()

static UniqueHash CombineHashes ( const H &...  hashes)

Computes a UniqueHash from a sequence of hash values.

[in]hashesA sequence of hash values.
A single hash value for the sequence of hash values.

Member Data Documentation

◆ low

UInt64 low

The lower 64 bits of the UniqueHash.

◆ high

UInt64 high

The higher 64 bits of the UniqueHash.