16#include <initializer_list>
36 Hash *= 0xff51afd7ed558ccdull;
38 Hash *= 0xc4ceb9fe1a85ec53ull;
48 Element *= 0xcc9e2d51;
49 Element = ( Element << 15 ) | ( Element >> (32 - 15) );
50 Element *= 0x1b873593;
65 Element *= 0x87c37b91114253d5ull;
66 Element = ( Element << 31 ) | ( Element >> (64 - 31) );
67 Element *= 0x4cf5ad432745937full;
92template< u
int16 HashSize, u
int16 IndexSize >
115template< u
int16 HashSize, u
int16 IndexSize >
118 static_assert( ( HashSize & (HashSize - 1) ) == 0,
"Hash size must be power of 2" );
119 static_assert( IndexSize - 1 < 0xffff,
"Index 0xffff is reserved" );
123template< u
int16 HashSize, u
int16 IndexSize >
126 static_assert((HashSize & (HashSize - 1)) == 0,
"Hash size must be power of 2");
127 static_assert(IndexSize - 1 < 0xffff,
"Index 0xffff is reserved");
130template< u
int16 HashSize, u
int16 IndexSize >
137template< u
int16 HashSize, u
int16 IndexSize >
145template< u
int16 HashSize, u
int16 IndexSize >
149 return NextIndex[
Index ];
152template< u
int16 HashSize, u
int16 IndexSize >
155 return Index != 0xffff;
158template< u
int16 HashSize, u
int16 IndexSize >
168template< u
int16 HashSize, u
int16 IndexSize >
184 if( NextIndex[i] ==
Index )
187 NextIndex[i] = NextIndex[
Index ];
263 , NextIndex( nullptr )
280 : HashSize(
Other.HashSize )
281 , HashMask(
Other.HashMask )
282 , IndexSize(
Other.IndexSize )
296 : HashSize(
Other.HashSize )
297 , HashMask(
Other.HashMask )
298 , IndexSize(
Other.IndexSize )
300 , NextIndex(
Other.NextIndex)
306 Other.NextIndex =
nullptr;
341 Other.NextIndex =
nullptr;
418 Resize( FMath::Max< uint32 >( 32u, FMath::RoundUpToPowerOfTwo(
Index + 1 ) ) );
465template<
typename InAllocator>
472 Allocator::NeedsElementType,
474 typename Allocator::ForAnyElementType
541template<
typename InAllocator>
554 NextIndex.ResizeAllocation(0, IndexSize,
sizeof(
uint32));
558template<
typename InAllocator>
563template<
typename InAllocator>
567 NextIndex.MoveToEmpty(
Other.NextIndex);
568 HashMask =
Other.HashMask;
569 IndexSize =
Other.IndexSize;
571 Other.IndexSize = 0u;
575template<
typename InAllocator>
585template<
typename InAllocator>
593template<
typename InAllocator>
602template<
typename InAllocator>
608template<
typename InAllocator>
611 if (
Index >= IndexSize)
613 Resize(FMath::Max<uint32>(32u, FMath::RoundUpToPowerOfTwo(
Index + 1)));
617 NextIndexAt(
Index) = HashAt(Key);
621template<
typename InAllocator>
624 if (
Index >= IndexSize)
630 if (HashAt(Key) ==
Index)
633 HashAt(Key) = NextIndexAt(
Index);
639 if (NextIndexAt(i) ==
Index)
642 NextIndexAt(i) = NextIndexAt(
Index);
649template<
typename InAllocator>
661 template<
typename InAllocator>
664 Object.WriteMemoryImage(Writer);
667 template<
typename InAllocator>
674 template<
typename InAllocator>
680 template<
typename InAllocator>
684 return FMath::Min(8u, LayoutParams.MaxFieldAlignment);
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define check(expr)
Definition AssertionMacros.h:314
ENoInit
Definition CoreMiscDefines.h:158
uint64 MurmurFinalize64(uint64 Hash)
Definition HashTable.h:33
uint64 Murmur64(std::initializer_list< uint64 > InitList)
Definition HashTable.h:60
uint32 Murmur32(std::initializer_list< uint32 > InitList)
Definition HashTable.h:43
uint32 MurmurFinalize32(uint32 Hash)
Definition HashTable.h:23
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_TEMPLATE_INTRINSIC_TYPE_LAYOUT(TemplatePrefix, T)
Definition MemoryLayout.h:661
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
Definition HashTable.h:210
uint32 HashSize
Definition HashTable.h:249
void Add_Concurrent(uint32 Key, uint32 Index)
Definition HashTable.h:429
~FHashTable()
Definition HashTable.h:345
void Free()
Definition HashTable.h:379
bool IsValid(uint32 Index) const
Definition HashTable.h:409
CORE_API float AverageSearch() const
Definition HashTable.cpp:47
void Clear()
Definition HashTable.h:350
uint32 * NextIndex
Definition HashTable.h:254
FHashTable & operator=(const FHashTable &Other)
Definition HashTable.h:309
CORE_API void Resize(uint32 NewIndexSize)
Definition HashTable.cpp:7
uint32 * Hash
Definition HashTable.h:253
void Remove(uint32 Key, uint32 Index)
Definition HashTable.h:437
uint32 HashMask
Definition HashTable.h:250
uint32 GetHashSize() const
Definition HashTable.h:226
void Add(uint32 Key, uint32 Index)
Definition HashTable.h:414
uint32 First(uint32 Key) const
Definition HashTable.h:395
uint32 IndexSize
Definition HashTable.h:251
FHashTable(uint32 InHashSize=1024, uint32 InIndexSize=0)
Definition HashTable.h:258
uint32 Next(uint32 Index) const
Definition HashTable.h:402
CORE_API SIZE_T GetAllocatedSize() const
Definition HashTable.cpp:39
uint32 GetIndexSize() const
Definition HashTable.h:225
static CORE_API uint32 EmptyHash[1]
Definition HashTable.h:5
Definition MemoryImageWriter.h:14
CORE_API uint32 WriteBytes(const void *Data, uint32 Size)
Definition MemoryImage.cpp:2143
Definition MemoryImageWriter.h:78
Definition MemoryImage.h:49
Definition SecureHash.h:314
Definition HashTable.h:467
THashTable & MoveAssign(THashTable &&Other)
Definition HashTable.h:564
THashTable(const THashTable &Other)=delete
THashTable & operator=(const THashTable &Other)=delete
void CopyUnfrozen(const FMemoryUnfreezeContent &Context, void *Dst) const
Definition HashTable.h:526
void Remove(uint16 Key, uint32 Index)
Definition HashTable.h:622
std::conditional_t< Allocator::NeedsElementType, typename Allocator::template ForElementType< uint32 >, typename Allocator::ForAnyElementType > ElementAllocatorType
Definition HashTable.h:475
bool IsValid(uint32 Index) const
Definition HashTable.h:603
THashTable(THashTable &&Other)
Definition HashTable.h:479
InAllocator Allocator
Definition HashTable.h:469
const uint32 * GetNextIndices() const
Definition HashTable.h:489
uint32 First(uint16 Key) const
Definition HashTable.h:586
~THashTable()
Definition HashTable.h:559
void Clear()
Definition HashTable.h:576
void Resize(uint32 NewIndexSize)
Definition HashTable.h:650
void Add(uint16 Key, uint32 Index)
Definition HashTable.h:609
THashTable(uint32 InHashSize=1024, uint32 InIndexSize=0)
Definition HashTable.h:542
uint32 Next(uint32 Index) const
Definition HashTable.h:594
void WriteMemoryImage(FMemoryImageWriter &Writer) const
Definition HashTable.h:511
THashTable & operator=(THashTable &&Other)
Definition HashTable.h:483
Definition HashTable.h:94
bool IsValid(uint16 Index) const
Definition HashTable.h:153
void Clear()
Definition HashTable.h:131
uint16 NextIndex[IndexSize]
Definition HashTable.h:112
TStaticHashTable()
Definition HashTable.h:116
uint16 Hash[HashSize]
Definition HashTable.h:111
uint16 Next(uint16 Index) const
Definition HashTable.h:146
TStaticHashTable(ENoInit)
Definition HashTable.h:124
void Add(uint16 Key, uint16 Index)
Definition HashTable.h:159
uint16 First(uint16 Key) const
Definition HashTable.h:138
void Remove(uint16 Key, uint16 Index)
Definition HashTable.h:169
CORE_API uint32 AppendHashForNameAndSize(const TCHAR *Name, uint32 Size, FSHA1 &Hasher)
Definition MemoryImage.cpp:568
UE_NODEBUG void IntrinsicWriteMemoryImage(FMemoryImageWriter &Writer, const TArray< T, AllocatorType > &Object, const FTypeLayoutDesc &)
Definition Array.h:3957
UE_NODEBUG uint32 IntrinsicUnfrozenCopy(const FMemoryUnfreezeContent &Context, const TArray< T, AllocatorType > &Object, void *OutDst)
Definition Array.h:3963
UE_NODEBUG uint32 IntrinsicGetTargetAlignment(const TArray< T, AllocatorType > *DummyObject, const FTypeLayoutDesc &TypeDesc, const FPlatformTypeLayoutParameters &LayoutParams)
Definition Array.h:3976
UE_NODEBUG uint32 IntrinsicAppendHash(const TArray< T, AllocatorType > *DummyObject, const FTypeLayoutDesc &TypeDesc, const FPlatformTypeLayoutParameters &LayoutParams, FSHA1 &Hasher)
Definition Array.h:3970
U16 Index
Definition radfft.cpp:71
static constexpr UE_FORCEINLINE_HINT bool IsPowerOfTwo(T Value)
Definition UnrealMathUtility.h:519
static UE_FORCEINLINE_HINT void * Memcpy(void *Dest, const void *Src, SIZE_T Count)
Definition UnrealMemory.h:160
static UE_FORCEINLINE_HINT void * Memset(void *Dest, uint8 Char, SIZE_T Count)
Definition UnrealMemory.h:119
Definition MemoryLayout.h:108
const TCHAR * Name
Definition MemoryLayout.h:127
Definition ContainerAllocationPolicies.h:256