PR comments/fixes

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-08-25 14:06:26 -07:00
parent b8aab28759
commit 058f6e0f22
15 changed files with 15 additions and 190 deletions
@@ -17,8 +17,6 @@
namespace AZ::Debug
{
constexpr static const char* BudgetTrackerEnvName = "budgetTrackerEnv";
struct BudgetTracker::BudgetTrackerImpl
{
AZStd::unordered_map<const char*, Budget> m_budgets;
+8 -16
View File
@@ -10,23 +10,16 @@
#ifndef GUID_DEFINED
#define GUID_DEFINED
typedef struct _GUID {
_GUID(unsigned long d1, unsigned short d2, unsigned short d3, std::initializer_list<unsigned char> d4)
: Data1(d1),
Data2(d2),
Data3(d3)
{
for (auto it = d4.begin(); it != d4.end(); ++it)
Data4[it - d4.begin()] = *it;
}
_GUID() = default;
#include <AzCore/std/containers/array.h>
struct _GUID {
uint32_t Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[ 8 ];
} GUID;
AZStd::array<unsigned char,8> Data4;
};
using GUID = _GUID;
#endif // GUID_DEFINED
#if !defined _SYS_GUID_OPERATOR_EQ_ && !defined _NO_SYS_GUID_OPERATOR_EQ_
@@ -36,7 +29,7 @@ static bool inline operator==(const _GUID& lhs, const _GUID& rhs)
return lhs.Data1 == rhs.Data1 &&
lhs.Data2 == rhs.Data2 &&
lhs.Data3 == rhs.Data3 &&
memcmp(lhs.Data4, rhs.Data4, 8) == 0;
lhs.Data4 == rhs.Data4;
}
static bool inline operator!=(const _GUID& lhs, const _GUID& rhs)
{
@@ -66,10 +59,9 @@ typedef const GUID& REFIID;
const GUID name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
inline REFGUID GUID_NULL()
inline constexpr GUID GUID_NULL()
{
static GUID guid = { 0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
return guid;
return { 0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
}
#define GUID_NULL GUID_NULL()
@@ -20,9 +20,7 @@ namespace AZ
public:
void ActivateAllocators()
{
// Note the parameter pack expansion, this creates the equivalent of a fold expression
// For each type, call InitAllocator<T>(), then put 0 in the initializer list
[[maybe_unused]] std::initializer_list<int> init{(InitAllocator<Allocators>(), 0)...};
(InitAllocator<Allocators>(), ...);
}
void DeactivateAllocators()
@@ -3774,8 +3774,7 @@ namespace AZ
template<class... Functions>
inline void OnDemandReflectFunctions(OnDemandReflectionOwner* onDemandReflection, AZStd::Internal::pack_traits_arg_sequence<Functions...>)
{
using PackExpander = bool[];
[[maybe_unused]] PackExpander pe = { true, (BehaviorOnDemandReflectHelper<typename AZStd::function_traits<Functions>::raw_fp_type>::QueueReflect(onDemandReflection), true)... };
(BehaviorOnDemandReflectHelper<typename AZStd::function_traits<Functions>::raw_fp_type>::QueueReflect(onDemandReflection), ...);
}
// Assumes parameters array is big enough to store all parameters
@@ -869,30 +869,13 @@ namespace AZStd
constexpr size_t hash_string(RandomAccessIterator first, size_t length)
{
size_t hash = 14695981039346656037ULL;
#if AZ_COMPILER_MSVC >= 1924
constexpr size_t fnvPrime = 1099511628211ULL;
#endif
const RandomAccessIterator last(first + length);
for (; first != last; ++first)
{
hash ^= static_cast<size_t>(*first);
#if AZ_COMPILER_MSVC < 1924
// Workaround for integer overflow warning for hash function when used in a constexpr context
// The warning must be disabled at the call site and is a compiler bug that has been fixed
// with Visual Studio 2019 version 16.4
// https://developercommunity.visualstudio.com/content/problem/211134/unsigned-integer-overflows-in-constexpr-functionsa.html?childToView=211580#comment-211580
constexpr size_t fnvPrimeHigh{ 0x100ULL };
constexpr size_t fnvPrimeLow{ 0x000001b3 };
const uint64_t hashHigh{ hash >> 32 };
const uint64_t hashLow{ hash & 0xFFFF'FFFF };
const uint64_t lowResult{ hashLow * fnvPrimeLow };
const uint64_t fnvPrimeHighResult{ hashLow * fnvPrimeHigh };
const uint64_t hashHighResult{ hashHigh * fnvPrimeLow };
hash = (lowResult & 0xffff'ffff) + (((lowResult >> 32) + (fnvPrimeHighResult & 0xffff'ffff) + (hashHighResult & 0xffff'ffff)) << 32);
#else
hash *= fnvPrime;
#endif
}
return hash;
}