diff --git a/Include/auROXTL/auHashUtils.hpp b/Include/auROXTL/auHashUtils.hpp index 3e867a20..161c3c1c 100644 --- a/Include/auROXTL/auHashUtils.hpp +++ b/Include/auROXTL/auHashUtils.hpp @@ -56,7 +56,7 @@ namespace AuHash #define _HASH_F_CPP(type) \ template<> struct hash \ { \ - AuUInt operator ()(type b) const \ + constexpr AuUInt operator ()(const type b) const \ { \ return AuFnv1aType(b); \ } \ diff --git a/Include/auROXTL/auTypeUtils.hpp b/Include/auROXTL/auTypeUtils.hpp index e9249716..e8b80dd1 100644 --- a/Include/auROXTL/auTypeUtils.hpp +++ b/Include/auROXTL/auTypeUtils.hpp @@ -23,9 +23,12 @@ static auline T AuReadGenericLE(const void *ptr, int offset) AuMemcpy(&temp, reinterpret_cast(ptr) + offset, sizeof(temp)); #endif -#if !defined(AU_CPU_ENDIAN_LITTLE) - temp = AuFlipEndian(temp); -#endif + if constexpr (sizeof(T) != 1) + { + #if !defined(AU_CPU_ENDIAN_LITTLE) + temp = AuFlipEndian(temp); + #endif + } return temp; } @@ -40,9 +43,12 @@ static auline T AuReadGenericBE(const void *ptr, int offset) AuMemcpy(&temp, reinterpret_cast(ptr) + offset, sizeof(temp)); #endif -#if defined(AU_CPU_ENDIAN_LITTLE) - temp = AuFlipEndian(temp); -#endif + if constexpr (sizeof(T) != 1) + { + #if defined(AU_CPU_ENDIAN_LITTLE) + temp = AuFlipEndian(temp); + #endif + } return temp; }