From a712ff6926754d6b69e50400a4070f8866bbe381 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 17 Jan 2024 10:11:18 -0500 Subject: [PATCH] Refactor HashTableOpt --- LEGO1/omni/include/mxhashtable.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/LEGO1/omni/include/mxhashtable.h b/LEGO1/omni/include/mxhashtable.h index 8d6be0cf..056ff402 100644 --- a/LEGO1/omni/include/mxhashtable.h +++ b/LEGO1/omni/include/mxhashtable.h @@ -32,10 +32,10 @@ class MxHashTableNode { template class MxHashTable : protected MxCollection { public: - enum HashTableOpt { - HashTableOpt_NoExpand = 0, - HashTableOpt_ExpandAdd = 1, - HashTableOpt_ExpandMultiply = 2, + enum Option { + e_noExpand = 0, + e_expandAll, + e_expandMultiply, }; MxHashTable() @@ -43,7 +43,7 @@ class MxHashTable : protected MxCollection { m_numSlots = HASH_TABLE_INIT_SIZE; m_slots = new MxHashTableNode*[HASH_TABLE_INIT_SIZE]; memset(m_slots, 0, sizeof(MxHashTableNode*) * m_numSlots); - m_resizeOption = HashTableOpt_NoExpand; + m_resizeOption = e_noExpand; } virtual ~MxHashTable() override; @@ -62,7 +62,7 @@ class MxHashTable : protected MxCollection { MxHashTableNode** m_slots; // 0x10 MxU32 m_numSlots; // 0x14 MxU32 m_autoResizeRatio; // 0x18 - HashTableOpt m_resizeOption; // 0x1c + Option m_resizeOption; // 0x1c // FIXME: or FIXME? This qword is used as an integer or double depending // on the value of m_resizeOption. Hard to say whether this is how the devs // did it, but a simple cast in either direction doesn't match. @@ -177,10 +177,10 @@ inline void MxHashTable::Resize() MxHashTableNode** oldTable = m_slots; switch (m_resizeOption) { - case HashTableOpt_ExpandAdd: + case e_expandAll: m_numSlots += m_increaseAmount; break; - case HashTableOpt_ExpandMultiply: + case e_expandMultiply: m_numSlots *= m_increaseFactor; break; }