UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FNameHash Struct Reference

Public Member Functions

template<class CharType >
 FNameHash (const CharType *Str, int32 Len)
 
template<class CharType >
 FNameHash (const CharType *Str, int32 Len, uint64 Hash)
 
 FNameHash (FNameEntryId StringPart, int32 NumberPart)
 
 FNameHash (ENoInit)
 
 FNameHash (uint64 Hash, int32 Len, bool IsNone, bool bIsWide)
 
uint32 GetProbeStart (uint32 SlotMask) const
 
bool operator== (const FNameHash &Rhs) const
 

Static Public Member Functions

static uint32 GetShardIndex (uint64 Hash)
 
template<class CharType >
static uint64 GenerateHash (const CharType *Str, int32 Len)
 
static uint64 GenerateHash (FNameEntryId StringPart, int32 NumberPart)
 
static uint32 GetProbeStart (uint32 UnmaskedSlotIndex, uint32 SlotMask)
 
static uint32 IsAnsiNone (const WIDECHAR *Str, int32 Len)
 
static uint32 IsAnsiNone (const ANSICHAR *Str, int32 Len)
 

Public Attributes

uint32 ShardIndex
 
uint32 UnmaskedSlotIndex
 
uint32 SlotProbeHash
 
FNameEntryHeader EntryProbeHeader
 

Static Public Attributes

static constexpr uint64 AlgorithmId = 0xC1640000
 
static constexpr uint32 ShardMask = FNamePoolShards - 1
 

Detailed Description

Hashes name into 64 bits that determines shard and slot index.

A small part of the hash is also stored in unused bits of the slot and entry. The former optimizes linear probing by accessing less entry data. The latter optimizes linear probing by avoiding copying and deobfuscating entry data.

The slot index could be stored in the slot, at least in non shipping / test configs. This costs memory by doubling slot size but would essentially never touch entry data nor copy and deobfuscate a name needlessy. It also allows growing the hash table without rehashing the strings, since the unmasked slot index would be known.

Constructor & Destructor Documentation

◆ FNameHash() [1/5]

template<class CharType >
FNameHash::FNameHash ( const CharType *  Str,
int32  Len 
)
inline

◆ FNameHash() [2/5]

template<class CharType >
FNameHash::FNameHash ( const CharType *  Str,
int32  Len,
uint64  Hash 
)
inline

◆ FNameHash() [3/5]

FNameHash::FNameHash ( FNameEntryId  StringPart,
int32  NumberPart 
)
inline

◆ FNameHash() [4/5]

FNameHash::FNameHash ( ENoInit  )
inline

◆ FNameHash() [5/5]

FNameHash::FNameHash ( uint64  Hash,
int32  Len,
bool  IsNone,
bool  bIsWide 
)
inline

Member Function Documentation

◆ GenerateHash() [1/2]

template<class CharType >
static uint64 FNameHash::GenerateHash ( const CharType *  Str,
int32  Len 
)
inlinestatic

◆ GenerateHash() [2/2]

static uint64 FNameHash::GenerateHash ( FNameEntryId  StringPart,
int32  NumberPart 
)
inlinestatic

◆ GetProbeStart() [1/2]

uint32 FNameHash::GetProbeStart ( uint32  SlotMask) const
inline

◆ GetProbeStart() [2/2]

static uint32 FNameHash::GetProbeStart ( uint32  UnmaskedSlotIndex,
uint32  SlotMask 
)
inlinestatic

◆ GetShardIndex()

static uint32 FNameHash::GetShardIndex ( uint64  Hash)
inlinestatic

◆ IsAnsiNone() [1/2]

static uint32 FNameHash::IsAnsiNone ( const ANSICHAR Str,
int32  Len 
)
inlinestatic

◆ IsAnsiNone() [2/2]

static uint32 FNameHash::IsAnsiNone ( const WIDECHAR Str,
int32  Len 
)
inlinestatic

◆ operator==()

bool FNameHash::operator== ( const FNameHash Rhs) const
inline

Member Data Documentation

◆ AlgorithmId

constexpr uint64 FNameHash::AlgorithmId = 0xC1640000
staticconstexpr

◆ EntryProbeHeader

FNameEntryHeader FNameHash::EntryProbeHeader

◆ ShardIndex

uint32 FNameHash::ShardIndex

◆ ShardMask

constexpr uint32 FNameHash::ShardMask = FNamePoolShards - 1
staticconstexpr

◆ SlotProbeHash

uint32 FNameHash::SlotProbeHash

◆ UnmaskedSlotIndex

uint32 FNameHash::UnmaskedSlotIndex

The documentation for this struct was generated from the following file: