Open Search
    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
     
     MAXON_OPERATOR_INEQUALITY (UniqueHash)
     
    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)
     

    Public Attributes

    UInt64 low
     
    UInt64 high
     

    Constructor & Destructor Documentation

    ◆ UniqueHash() [1/2]

    UniqueHash ( )
    default

    ◆ UniqueHash() [2/2]

    constexpr UniqueHash ( UInt64  l,
    UInt64  h 
    )
    constexpr

    Member Function Documentation

    ◆ TriviallyHashable()

    static constexpr Bool TriviallyHashable ( )
    staticconstexpr

    ◆ operator==()

    Bool operator== ( const UniqueHash other) const

    ◆ operator!=()

    Bool operator!= ( const UniqueHash other) const

    ◆ operator<()

    Bool operator< ( const UniqueHash other) const

    ◆ MAXON_OPERATOR_INEQUALITY()

    MAXON_OPERATOR_INEQUALITY ( UniqueHash  )

    ◆ GetHashCode()

    HashInt GetHashCode ( ) const

    ◆ GetUniqueHashCode()

    const UniqueHash& GetUniqueHashCode ( ) const

    ◆ operator&()

    constexpr UInt operator& ( UInt  mask) const
    constexpr

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

    Parameters
    [in]maskA bit mask.
    Returns
    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.

    Parameters
    [in]otherAnother UniqueHash.

    Member Data Documentation

    ◆ low

    UInt64 low

    The lower 64 bits of the UniqueHash.

    ◆ high

    UInt64 high

    The higher 64 bits of the UniqueHash.