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

#include <PM-k.h>

Public Member Functions

 FPredictMatch8 ()
 
uint16 GetMinimumWordLength () const
 
void AddPredictionWord (const uint8 *Data, const uint16 DataLen)
 
bool MatchApproximate (const uint8 *Data, const uint32 DataLen) const
 
void Reset ()
 

Static Public Attributes

static constexpr uint16 TABLE_SIZE = 256
 
static constexpr uint16 ALPHABET_SIZE = 256
 

Detailed Description

Predict Match (pm-k) is a fuzzy matching algorithm that enables looking for a potential match across multiple substrings at the same time. We take two approaches, one is Bitap (Bit Approximation) which uses a sliding window of the size of the smallest substring (small substrings will create more false positives). Bitap is very quick for scanning potential matches. We then use pm-8, a sliding window of a fixed size (in our case 8 bytes), to further look for potential matches. If we find a hit, we must defer to slower substring matching approaches to confirm the match. PredictMatch relies on hashing to distribute the mapping of characters in substrings at specific offsets. This hashing helps reduce overlaps between similar substrings which reduces false positives, however this does mean that if your hash is poor, or the table size is too small, you may have more false positives than preferred.

This implementation is written by Epic but based on the licensed pm4-bitap.c implementation found at https://www.genivia.com/ugrep.html

Constructor & Destructor Documentation

◆ FPredictMatch8()

FPredictMatch8::FPredictMatch8 ( )
inline

Member Function Documentation

◆ AddPredictionWord()

void FPredictMatch8::AddPredictionWord ( const uint8 Data,
const uint16  DataLen 
)
inline

◆ GetMinimumWordLength()

uint16 FPredictMatch8::GetMinimumWordLength ( ) const
inline

◆ MatchApproximate()

bool FPredictMatch8::MatchApproximate ( const uint8 Data,
const uint32  DataLen 
) const
inline

◆ Reset()

void FPredictMatch8::Reset ( )
inline

Member Data Documentation

◆ ALPHABET_SIZE

constexpr uint16 FPredictMatch8::ALPHABET_SIZE = 256
staticconstexpr

◆ TABLE_SIZE

constexpr uint16 FPredictMatch8::TABLE_SIZE = 256
staticconstexpr

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