From ecced7e44d873db3aa3fa7200e319fbd03eb0c3c Mon Sep 17 00:00:00 2001 From: Reece Date: Thu, 24 Mar 2022 09:01:42 +0000 Subject: [PATCH] AAAAAHHH THE POSTERS ANDY --- Include/auROXTL/auHashUtils.hpp | 2 +- Include/auROXTL/auTypeUtils.hpp | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) 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; }