Plasma Engine  2.0
Loading...
Searching...
No Matches
Uuid_inl.h
1
2bool plUuid::operator==(const plUuid& other) const
3{
4 return m_uiHigh == other.m_uiHigh && m_uiLow == other.m_uiLow;
5}
6
7bool plUuid::operator!=(const plUuid& other) const
8{
9 return m_uiHigh != other.m_uiHigh || m_uiLow != other.m_uiLow;
10}
11
12bool plUuid::operator<(const plUuid& other) const
13{
14 if (m_uiHigh < other.m_uiHigh)
15 return true;
16 if (m_uiHigh > other.m_uiHigh)
17 return false;
18
19 return m_uiLow < other.m_uiLow;
20}
21
22bool plUuid::IsValid() const
23{
24 return m_uiHigh != 0 || m_uiLow != 0;
25}
26
28{
29 m_uiHigh += seed.m_uiHigh;
30 m_uiLow += seed.m_uiLow;
31}
32
34{
35 m_uiHigh -= seed.m_uiHigh;
36 m_uiLow -= seed.m_uiLow;
37}
38
39void plUuid::HashCombine(const plUuid& guid)
40{
41 m_uiHigh = plHashingUtils::xxHash64(&guid.m_uiHigh, sizeof(plUInt64), m_uiHigh);
42 m_uiLow = plHashingUtils::xxHash64(&guid.m_uiLow, sizeof(plUInt64), m_uiLow);
43}
44
45template <>
47{
48 PL_ALWAYS_INLINE static plUInt32 Hash(const plUuid& value) { return plHashingUtils::xxHash32(&value, sizeof(plUuid)); }
49
50 PL_ALWAYS_INLINE static bool Equal(const plUuid& a, const plUuid& b) { return a == b; }
51};
static plUInt32 xxHash32(const void *pKey, size_t uiSizeInByte, plUInt32 uiSeed=0)
Calculates the 32bit xxHash of the given key.
Definition HashingUtils.cpp:209
static plUInt64 xxHash64(const void *pKey, size_t uiSizeInByte, plUInt64 uiSeed=0)
Calculates the 64bit xxHash of the given key.
Definition HashingUtils.cpp:215
This data type is the abstraction for 128-bit Uuid (also known as GUID) instances.
Definition Uuid.h:11
PL_ALWAYS_INLINE void RevertCombinationWithSeed(const plUuid &seed)
Subtracts the given seed from this guid, restoring the original guid.
Definition Uuid_inl.h:33
PL_ALWAYS_INLINE void CombineWithSeed(const plUuid &seed)
Adds the given seed value to this guid, creating a new guid. The process is reversible.
Definition Uuid_inl.h:27
PL_ALWAYS_INLINE bool operator==(const plUuid &other) const
Comparison operator. [tested].
Definition Uuid_inl.h:2
PL_ALWAYS_INLINE bool IsValid() const
Returns true if this is a valid Uuid.
Definition Uuid_inl.h:22
PL_ALWAYS_INLINE bool operator!=(const plUuid &other) const
Comparison operator. [tested].
Definition Uuid_inl.h:7
PL_ALWAYS_INLINE bool operator<(const plUuid &other) const
Comparison operator.
Definition Uuid_inl.h:12
PL_ALWAYS_INLINE void HashCombine(const plUuid &hash)
Combines two guids using hashing, irreversible and order dependent.
Definition Uuid_inl.h:39
Helper struct to calculate the Hash of different types.
Definition HashingUtils.h:75