mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
cppkore uses string/wstring as StringBase while we use std::string/std::wstring as string/wstring. Changed all types in cppkore to String/WString instead.
23 lines
545 B
C++
23 lines
545 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include "XXHash.h"
|
|
|
|
template<class TType>
|
|
struct HashComparer
|
|
{
|
|
constexpr static uint64_t GetHashCode(TType& Value)
|
|
{
|
|
if constexpr (std::is_arithmetic<TType>::value)
|
|
return Hashing::XXHash::HashValue(Value);
|
|
else if constexpr (std::is_enum<TType>::value)
|
|
return Hashing::XXHash::HashValue((uint32_t)Value);
|
|
else if constexpr (std::is_same<TType, String>::value)
|
|
return Hashing::XXHash::HashString(Value);
|
|
}
|
|
|
|
constexpr static bool Equals(TType& Lhs, TType& Rhs)
|
|
{
|
|
return (Lhs == Rhs);
|
|
}
|
|
}; |