Path: blob/master/thirdparty/jolt_physics/Jolt/Core/HashTable.h
9906 views
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)1// SPDX-FileCopyrightText: 2024 Jorrit Rouwe2// SPDX-License-Identifier: MIT34#pragma once56#include <Jolt/Math/BVec16.h>78JPH_NAMESPACE_BEGIN910/// Helper class for implementing an UnorderedSet or UnorderedMap11/// Based on CppCon 2017: Matt Kulukundis "Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step"12/// See: https://www.youtube.com/watch?v=ncHmEUmJZf413template <class Key, class KeyValue, class HashTableDetail, class Hash, class KeyEqual>14class HashTable15{16public:17/// Properties18using value_type = KeyValue;19using size_type = uint32;20using difference_type = ptrdiff_t;2122private:23/// Base class for iterators24template <class Table, class Iterator>25class IteratorBase26{27public:28/// Properties29using difference_type = typename Table::difference_type;30using value_type = typename Table::value_type;31using iterator_category = std::forward_iterator_tag;3233/// Copy constructor34IteratorBase(const IteratorBase &inRHS) = default;3536/// Assignment operator37IteratorBase & operator = (const IteratorBase &inRHS) = default;3839/// Iterator at start of table40explicit IteratorBase(Table *inTable) :41mTable(inTable),42mIndex(0)43{44while (mIndex < mTable->mMaxSize && (mTable->mControl[mIndex] & cBucketUsed) == 0)45++mIndex;46}4748/// Iterator at specific index49IteratorBase(Table *inTable, size_type inIndex) :50mTable(inTable),51mIndex(inIndex)52{53}5455/// Prefix increment56Iterator & operator ++ ()57{58JPH_ASSERT(IsValid());5960do61{62++mIndex;63}64while (mIndex < mTable->mMaxSize && (mTable->mControl[mIndex] & cBucketUsed) == 0);6566return static_cast<Iterator &>(*this);67}6869/// Postfix increment70Iterator operator ++ (int)71{72Iterator result(mTable, mIndex);73++(*this);74return result;75}7677/// Access to key value pair78const KeyValue & operator * () const79{80JPH_ASSERT(IsValid());81return mTable->mData[mIndex];82}8384/// Access to key value pair85const KeyValue * operator -> () const86{87JPH_ASSERT(IsValid());88return mTable->mData + mIndex;89}9091/// Equality operator92bool operator == (const Iterator &inRHS) const93{94return mIndex == inRHS.mIndex && mTable == inRHS.mTable;95}9697/// Inequality operator98bool operator != (const Iterator &inRHS) const99{100return !(*this == inRHS);101}102103/// Check that the iterator is valid104bool IsValid() const105{106return mIndex < mTable->mMaxSize107&& (mTable->mControl[mIndex] & cBucketUsed) != 0;108}109110Table * mTable;111size_type mIndex;112};113114/// Get the maximum number of elements that we can support given a number of buckets115static constexpr size_type sGetMaxLoad(size_type inBucketCount)116{117return uint32((cMaxLoadFactorNumerator * inBucketCount) / cMaxLoadFactorDenominator);118}119120/// Update the control value for a bucket121JPH_INLINE void SetControlValue(size_type inIndex, uint8 inValue)122{123JPH_ASSERT(inIndex < mMaxSize);124mControl[inIndex] = inValue;125126// Mirror the first 15 bytes to the 15 bytes beyond mMaxSize127// Note that this is equivalent to:128// if (inIndex < 15)129// mControl[inIndex + mMaxSize] = inValue130// else131// mControl[inIndex] = inValue132// Which performs a needless write if inIndex >= 15 but at least it is branch-less133mControl[((inIndex - 15) & (mMaxSize - 1)) + 15] = inValue;134}135136/// Get the index and control value for a particular key137JPH_INLINE void GetIndexAndControlValue(const Key &inKey, size_type &outIndex, uint8 &outControl) const138{139// Calculate hash140uint64 hash_value = Hash { } (inKey);141142// Split hash into index and control value143outIndex = size_type(hash_value >> 7) & (mMaxSize - 1);144outControl = cBucketUsed | uint8(hash_value);145}146147/// Allocate space for the hash table148void AllocateTable(size_type inMaxSize)149{150JPH_ASSERT(mData == nullptr);151152mMaxSize = inMaxSize;153mLoadLeft = sGetMaxLoad(inMaxSize);154size_t required_size = size_t(mMaxSize) * (sizeof(KeyValue) + 1) + 15; // Add 15 bytes to mirror the first 15 bytes of the control values155if constexpr (cNeedsAlignedAllocate)156mData = reinterpret_cast<KeyValue *>(AlignedAllocate(required_size, alignof(KeyValue)));157else158mData = reinterpret_cast<KeyValue *>(Allocate(required_size));159mControl = reinterpret_cast<uint8 *>(mData + mMaxSize);160}161162/// Copy the contents of another hash table163void CopyTable(const HashTable &inRHS)164{165if (inRHS.empty())166return;167168AllocateTable(inRHS.mMaxSize);169170// Copy control bytes171memcpy(mControl, inRHS.mControl, mMaxSize + 15);172173// Copy elements174uint index = 0;175for (const uint8 *control = mControl, *control_end = mControl + mMaxSize; control != control_end; ++control, ++index)176if (*control & cBucketUsed)177new (mData + index) KeyValue(inRHS.mData[index]);178mSize = inRHS.mSize;179}180181/// Grow the table to a new size182void GrowTable(size_type inNewMaxSize)183{184// Move the old table to a temporary structure185size_type old_max_size = mMaxSize;186KeyValue *old_data = mData;187const uint8 *old_control = mControl;188mData = nullptr;189mControl = nullptr;190mSize = 0;191mMaxSize = 0;192mLoadLeft = 0;193194// Allocate new table195AllocateTable(inNewMaxSize);196197// Reset all control bytes198memset(mControl, cBucketEmpty, mMaxSize + 15);199200if (old_data != nullptr)201{202// Copy all elements from the old table203for (size_type i = 0; i < old_max_size; ++i)204if (old_control[i] & cBucketUsed)205{206size_type index;207KeyValue *element = old_data + i;208JPH_IF_ENABLE_ASSERTS(bool inserted =) InsertKey</* InsertAfterGrow= */ true>(HashTableDetail::sGetKey(*element), index);209JPH_ASSERT(inserted);210new (mData + index) KeyValue(std::move(*element));211element->~KeyValue();212}213214// Free memory215if constexpr (cNeedsAlignedAllocate)216AlignedFree(old_data);217else218Free(old_data);219}220}221222protected:223/// Get an element by index224KeyValue & GetElement(size_type inIndex) const225{226return mData[inIndex];227}228229/// Insert a key into the map, returns true if the element was inserted, false if it already existed.230/// outIndex is the index at which the element should be constructed / where it is located.231template <bool InsertAfterGrow = false>232bool InsertKey(const Key &inKey, size_type &outIndex)233{234// Ensure we have enough space235if (mLoadLeft == 0)236{237// Should not be growing if we're already growing!238if constexpr (InsertAfterGrow)239JPH_ASSERT(false);240241// Decide if we need to clean up all tombstones or if we need to grow the map242size_type num_deleted = sGetMaxLoad(mMaxSize) - mSize;243if (num_deleted * cMaxDeletedElementsDenominator > mMaxSize * cMaxDeletedElementsNumerator)244rehash(0);245else246{247// Grow by a power of 2248size_type new_max_size = max<size_type>(mMaxSize << 1, 16);249if (new_max_size < mMaxSize)250{251JPH_ASSERT(false, "Overflow in hash table size, can't grow!");252return false;253}254GrowTable(new_max_size);255}256}257258// Split hash into index and control value259size_type index;260uint8 control;261GetIndexAndControlValue(inKey, index, control);262263// Keeps track of the index of the first deleted bucket we found264constexpr size_type cNoDeleted = ~size_type(0);265size_type first_deleted_index = cNoDeleted;266267// Linear probing268KeyEqual equal;269size_type bucket_mask = mMaxSize - 1;270BVec16 control16 = BVec16::sReplicate(control);271BVec16 bucket_empty = BVec16::sZero();272BVec16 bucket_deleted = BVec16::sReplicate(cBucketDeleted);273for (;;)274{275// Read 16 control values (note that we added 15 bytes at the end of the control values that mirror the first 15 bytes)276BVec16 control_bytes = BVec16::sLoadByte16(mControl + index);277278// Check if we must find the element before we can insert279if constexpr (!InsertAfterGrow)280{281// Check for the control value we're looking for282// Note that when deleting we can create empty buckets instead of deleted buckets.283// This means we must unconditionally check all buckets in this batch for equality284// (also beyond the first empty bucket).285uint32 control_equal = uint32(BVec16::sEquals(control_bytes, control16).GetTrues());286287// Index within the 16 buckets288size_type local_index = index;289290// Loop while there's still buckets to process291while (control_equal != 0)292{293// Get the first equal bucket294uint first_equal = CountTrailingZeros(control_equal);295296// Skip to the bucket297local_index += first_equal;298299// Make sure that our index is not beyond the end of the table300local_index &= bucket_mask;301302// We found a bucket with same control value303if (equal(HashTableDetail::sGetKey(mData[local_index]), inKey))304{305// Element already exists306outIndex = local_index;307return false;308}309310// Skip past this bucket311control_equal >>= first_equal + 1;312local_index++;313}314315// Check if we're still scanning for deleted buckets316if (first_deleted_index == cNoDeleted)317{318// Check if any buckets have been deleted, if so store the first one319uint32 control_deleted = uint32(BVec16::sEquals(control_bytes, bucket_deleted).GetTrues());320if (control_deleted != 0)321first_deleted_index = index + CountTrailingZeros(control_deleted);322}323}324325// Check for empty buckets326uint32 control_empty = uint32(BVec16::sEquals(control_bytes, bucket_empty).GetTrues());327if (control_empty != 0)328{329// If we found a deleted bucket, use it.330// It doesn't matter if it is before or after the first empty bucket we found331// since we will always be scanning in batches of 16 buckets.332if (first_deleted_index == cNoDeleted || InsertAfterGrow)333{334index += CountTrailingZeros(control_empty);335--mLoadLeft; // Using an empty bucket decreases the load left336}337else338{339index = first_deleted_index;340}341342// Make sure that our index is not beyond the end of the table343index &= bucket_mask;344345// Update control byte346SetControlValue(index, control);347++mSize;348349// Return index to newly allocated bucket350outIndex = index;351return true;352}353354// Move to next batch of 16 buckets355index = (index + 16) & bucket_mask;356}357}358359public:360/// Non-const iterator361class iterator : public IteratorBase<HashTable, iterator>362{363using Base = IteratorBase<HashTable, iterator>;364365public:366/// Properties367using reference = typename Base::value_type &;368using pointer = typename Base::value_type *;369370/// Constructors371explicit iterator(HashTable *inTable) : Base(inTable) { }372iterator(HashTable *inTable, size_type inIndex) : Base(inTable, inIndex) { }373iterator(const iterator &inIterator) : Base(inIterator) { }374375/// Assignment376iterator & operator = (const iterator &inRHS) { Base::operator = (inRHS); return *this; }377378using Base::operator *;379380/// Non-const access to key value pair381KeyValue & operator * ()382{383JPH_ASSERT(this->IsValid());384return this->mTable->mData[this->mIndex];385}386387using Base::operator ->;388389/// Non-const access to key value pair390KeyValue * operator -> ()391{392JPH_ASSERT(this->IsValid());393return this->mTable->mData + this->mIndex;394}395};396397/// Const iterator398class const_iterator : public IteratorBase<const HashTable, const_iterator>399{400using Base = IteratorBase<const HashTable, const_iterator>;401402public:403/// Properties404using reference = const typename Base::value_type &;405using pointer = const typename Base::value_type *;406407/// Constructors408explicit const_iterator(const HashTable *inTable) : Base(inTable) { }409const_iterator(const HashTable *inTable, size_type inIndex) : Base(inTable, inIndex) { }410const_iterator(const const_iterator &inRHS) : Base(inRHS) { }411const_iterator(const iterator &inIterator) : Base(inIterator.mTable, inIterator.mIndex) { }412413/// Assignment414const_iterator & operator = (const iterator &inRHS) { this->mTable = inRHS.mTable; this->mIndex = inRHS.mIndex; return *this; }415const_iterator & operator = (const const_iterator &inRHS) { Base::operator = (inRHS); return *this; }416};417418/// Default constructor419HashTable() = default;420421/// Copy constructor422HashTable(const HashTable &inRHS)423{424CopyTable(inRHS);425}426427/// Move constructor428HashTable(HashTable &&ioRHS) noexcept :429mData(ioRHS.mData),430mControl(ioRHS.mControl),431mSize(ioRHS.mSize),432mMaxSize(ioRHS.mMaxSize),433mLoadLeft(ioRHS.mLoadLeft)434{435ioRHS.mData = nullptr;436ioRHS.mControl = nullptr;437ioRHS.mSize = 0;438ioRHS.mMaxSize = 0;439ioRHS.mLoadLeft = 0;440}441442/// Assignment operator443HashTable & operator = (const HashTable &inRHS)444{445if (this != &inRHS)446{447clear();448449CopyTable(inRHS);450}451452return *this;453}454455/// Move assignment operator456HashTable & operator = (HashTable &&ioRHS) noexcept457{458if (this != &ioRHS)459{460clear();461462mData = ioRHS.mData;463mControl = ioRHS.mControl;464mSize = ioRHS.mSize;465mMaxSize = ioRHS.mMaxSize;466mLoadLeft = ioRHS.mLoadLeft;467468ioRHS.mData = nullptr;469ioRHS.mControl = nullptr;470ioRHS.mSize = 0;471ioRHS.mMaxSize = 0;472ioRHS.mLoadLeft = 0;473}474475return *this;476}477478/// Destructor479~HashTable()480{481clear();482}483484/// Reserve memory for a certain number of elements485void reserve(size_type inMaxSize)486{487// Calculate max size based on load factor488size_type max_size = GetNextPowerOf2(max<uint32>((cMaxLoadFactorDenominator * inMaxSize) / cMaxLoadFactorNumerator, 16));489if (max_size <= mMaxSize)490return;491492GrowTable(max_size);493}494495/// Destroy the entire hash table496void clear()497{498// Delete all elements499if constexpr (!std::is_trivially_destructible<KeyValue>())500if (!empty())501for (size_type i = 0; i < mMaxSize; ++i)502if (mControl[i] & cBucketUsed)503mData[i].~KeyValue();504505if (mData != nullptr)506{507// Free memory508if constexpr (cNeedsAlignedAllocate)509AlignedFree(mData);510else511Free(mData);512513// Reset members514mData = nullptr;515mControl = nullptr;516mSize = 0;517mMaxSize = 0;518mLoadLeft = 0;519}520}521522/// Destroy the entire hash table but keeps the memory allocated523void ClearAndKeepMemory()524{525// Destruct elements526if constexpr (!std::is_trivially_destructible<KeyValue>())527if (!empty())528for (size_type i = 0; i < mMaxSize; ++i)529if (mControl[i] & cBucketUsed)530mData[i].~KeyValue();531mSize = 0;532533// If there are elements that are not marked cBucketEmpty, we reset them534size_type max_load = sGetMaxLoad(mMaxSize);535if (mLoadLeft != max_load)536{537// Reset all control bytes538memset(mControl, cBucketEmpty, mMaxSize + 15);539mLoadLeft = max_load;540}541}542543/// Iterator to first element544iterator begin()545{546return iterator(this);547}548549/// Iterator to one beyond last element550iterator end()551{552return iterator(this, mMaxSize);553}554555/// Iterator to first element556const_iterator begin() const557{558return const_iterator(this);559}560561/// Iterator to one beyond last element562const_iterator end() const563{564return const_iterator(this, mMaxSize);565}566567/// Iterator to first element568const_iterator cbegin() const569{570return const_iterator(this);571}572573/// Iterator to one beyond last element574const_iterator cend() const575{576return const_iterator(this, mMaxSize);577}578579/// Number of buckets in the table580size_type bucket_count() const581{582return mMaxSize;583}584585/// Max number of buckets that the table can have586constexpr size_type max_bucket_count() const587{588return size_type(1) << (sizeof(size_type) * 8 - 1);589}590591/// Check if there are no elements in the table592bool empty() const593{594return mSize == 0;595}596597/// Number of elements in the table598size_type size() const599{600return mSize;601}602603/// Max number of elements that the table can hold604constexpr size_type max_size() const605{606return size_type((uint64(max_bucket_count()) * cMaxLoadFactorNumerator) / cMaxLoadFactorDenominator);607}608609/// Get the max load factor for this table (max number of elements / number of buckets)610constexpr float max_load_factor() const611{612return float(cMaxLoadFactorNumerator) / float(cMaxLoadFactorDenominator);613}614615/// Insert a new element, returns iterator and if the element was inserted616std::pair<iterator, bool> insert(const value_type &inValue)617{618size_type index;619bool inserted = InsertKey(HashTableDetail::sGetKey(inValue), index);620if (inserted)621new (mData + index) KeyValue(inValue);622return std::make_pair(iterator(this, index), inserted);623}624625/// Find an element, returns iterator to element or end() if not found626const_iterator find(const Key &inKey) const627{628// Check if we have any data629if (empty())630return cend();631632// Split hash into index and control value633size_type index;634uint8 control;635GetIndexAndControlValue(inKey, index, control);636637// Linear probing638KeyEqual equal;639size_type bucket_mask = mMaxSize - 1;640BVec16 control16 = BVec16::sReplicate(control);641BVec16 bucket_empty = BVec16::sZero();642for (;;)643{644// Read 16 control values645// (note that we added 15 bytes at the end of the control values that mirror the first 15 bytes)646BVec16 control_bytes = BVec16::sLoadByte16(mControl + index);647648// Check for the control value we're looking for649// Note that when deleting we can create empty buckets instead of deleted buckets.650// This means we must unconditionally check all buckets in this batch for equality651// (also beyond the first empty bucket).652uint32 control_equal = uint32(BVec16::sEquals(control_bytes, control16).GetTrues());653654// Index within the 16 buckets655size_type local_index = index;656657// Loop while there's still buckets to process658while (control_equal != 0)659{660// Get the first equal bucket661uint first_equal = CountTrailingZeros(control_equal);662663// Skip to the bucket664local_index += first_equal;665666// Make sure that our index is not beyond the end of the table667local_index &= bucket_mask;668669// We found a bucket with same control value670if (equal(HashTableDetail::sGetKey(mData[local_index]), inKey))671{672// Element found673return const_iterator(this, local_index);674}675676// Skip past this bucket677control_equal >>= first_equal + 1;678local_index++;679}680681// Check for empty buckets682uint32 control_empty = uint32(BVec16::sEquals(control_bytes, bucket_empty).GetTrues());683if (control_empty != 0)684{685// An empty bucket was found, we didn't find the element686return cend();687}688689// Move to next batch of 16 buckets690index = (index + 16) & bucket_mask;691}692}693694/// @brief Erase an element by iterator695void erase(const const_iterator &inIterator)696{697JPH_ASSERT(inIterator.IsValid());698699// Read 16 control values before and after the current index700// (note that we added 15 bytes at the end of the control values that mirror the first 15 bytes)701BVec16 control_bytes_before = BVec16::sLoadByte16(mControl + ((inIterator.mIndex - 16) & (mMaxSize - 1)));702BVec16 control_bytes_after = BVec16::sLoadByte16(mControl + inIterator.mIndex);703BVec16 bucket_empty = BVec16::sZero();704uint32 control_empty_before = uint32(BVec16::sEquals(control_bytes_before, bucket_empty).GetTrues());705uint32 control_empty_after = uint32(BVec16::sEquals(control_bytes_after, bucket_empty).GetTrues());706707// If (this index including) there exist 16 consecutive non-empty slots (represented by a bit being 0) then708// a probe looking for some element needs to continue probing so we cannot mark the bucket as empty709// but must mark it as deleted instead.710// Note that we use: CountLeadingZeros(uint16) = CountLeadingZeros(uint32) - 16.711uint8 control_value = CountLeadingZeros(control_empty_before) - 16 + CountTrailingZeros(control_empty_after) < 16? cBucketEmpty : cBucketDeleted;712713// Mark the bucket as empty/deleted714SetControlValue(inIterator.mIndex, control_value);715716// Destruct the element717mData[inIterator.mIndex].~KeyValue();718719// If we marked the bucket as empty we can increase the load left720if (control_value == cBucketEmpty)721++mLoadLeft;722723// Decrease size724--mSize;725}726727/// @brief Erase an element by key728size_type erase(const Key &inKey)729{730const_iterator it = find(inKey);731if (it == cend())732return 0;733734erase(it);735return 1;736}737738/// Swap the contents of two hash tables739void swap(HashTable &ioRHS) noexcept740{741std::swap(mData, ioRHS.mData);742std::swap(mControl, ioRHS.mControl);743std::swap(mSize, ioRHS.mSize);744std::swap(mMaxSize, ioRHS.mMaxSize);745std::swap(mLoadLeft, ioRHS.mLoadLeft);746}747748/// In place re-hashing of all elements in the table. Removes all cBucketDeleted elements749/// The std version takes a bucket count, but we just re-hash to the same size.750void rehash(size_type)751{752// Update the control value for all buckets753for (size_type i = 0; i < mMaxSize; ++i)754{755uint8 &control = mControl[i];756switch (control)757{758case cBucketDeleted:759// Deleted buckets become empty760control = cBucketEmpty;761break;762case cBucketEmpty:763// Remains empty764break;765default:766// Mark all occupied as deleted, to indicate it needs to move to the correct place767control = cBucketDeleted;768break;769}770}771772// Replicate control values to the last 15 entries773for (size_type i = 0; i < 15; ++i)774mControl[mMaxSize + i] = mControl[i];775776// Loop over all elements that have been 'deleted' and move them to their new spot777BVec16 bucket_used = BVec16::sReplicate(cBucketUsed);778size_type bucket_mask = mMaxSize - 1;779uint32 probe_mask = bucket_mask & ~uint32(0b1111); // Mask out lower 4 bits because we test 16 buckets at a time780for (size_type src = 0; src < mMaxSize; ++src)781if (mControl[src] == cBucketDeleted)782for (;;)783{784// Split hash into index and control value785size_type src_index;786uint8 src_control;787GetIndexAndControlValue(HashTableDetail::sGetKey(mData[src]), src_index, src_control);788789// Linear probing790size_type dst = src_index;791for (;;)792{793// Check if any buckets are free794BVec16 control_bytes = BVec16::sLoadByte16(mControl + dst);795uint32 control_free = uint32(BVec16::sAnd(control_bytes, bucket_used).GetTrues()) ^ 0xffff;796if (control_free != 0)797{798// Select this bucket as destination799dst += CountTrailingZeros(control_free);800dst &= bucket_mask;801break;802}803804// Move to next batch of 16 buckets805dst = (dst + 16) & bucket_mask;806}807808// Check if we stay in the same probe group809if (((dst - src_index) & probe_mask) == ((src - src_index) & probe_mask))810{811// We stay in the same group, we can stay where we are812SetControlValue(src, src_control);813break;814}815else if (mControl[dst] == cBucketEmpty)816{817// There's an empty bucket, move us there818SetControlValue(dst, src_control);819SetControlValue(src, cBucketEmpty);820new (mData + dst) KeyValue(std::move(mData[src]));821mData[src].~KeyValue();822break;823}824else825{826// There's an element in the bucket we want to move to, swap them827JPH_ASSERT(mControl[dst] == cBucketDeleted);828SetControlValue(dst, src_control);829std::swap(mData[src], mData[dst]);830// Iterate again with the same source bucket831}832}833834// Reinitialize load left835mLoadLeft = sGetMaxLoad(mMaxSize) - mSize;836}837838private:839/// If this allocator needs to fall back to aligned allocations because the type requires it840static constexpr bool cNeedsAlignedAllocate = alignof(KeyValue) > (JPH_CPU_ADDRESS_BITS == 32? 8 : 16);841842/// Max load factor is cMaxLoadFactorNumerator / cMaxLoadFactorDenominator843static constexpr uint64 cMaxLoadFactorNumerator = 7;844static constexpr uint64 cMaxLoadFactorDenominator = 8;845846/// If we can recover this fraction of deleted elements, we'll reshuffle the buckets in place rather than growing the table847static constexpr uint64 cMaxDeletedElementsNumerator = 1;848static constexpr uint64 cMaxDeletedElementsDenominator = 8;849850/// Values that the control bytes can have851static constexpr uint8 cBucketEmpty = 0;852static constexpr uint8 cBucketDeleted = 0x7f;853static constexpr uint8 cBucketUsed = 0x80; // Lowest 7 bits are lowest 7 bits of the hash value854855/// The buckets, an array of size mMaxSize856KeyValue * mData = nullptr;857858/// Control bytes, an array of size mMaxSize + 15859uint8 * mControl = nullptr;860861/// Number of elements in the table862size_type mSize = 0;863864/// Max number of elements that can be stored in the table865size_type mMaxSize = 0;866867/// Number of elements we can add to the table before we need to grow868size_type mLoadLeft = 0;869};870871JPH_NAMESPACE_END872873874