Batch #4792 by youko: 0 byte-identical, 1 confirmed by peer review. - fn_45446 LexiconSerializer::Insert: logic confirmed by peer review Peer-reviewed-by: eAthena, alisonrag, KWDev, Bruwuno Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). Adds to the build: Source/LexiconTrie.cpp
30 lines
824 B
C++
30 lines
824 B
C++
#ifndef RAGNAROK_SOURCE_UTILITY_LEXICON_LEXICONSERIALIZER_H
|
|
#define RAGNAROK_SOURCE_UTILITY_LEXICON_LEXICONSERIALIZER_H
|
|
|
|
#include <cstdint>
|
|
|
|
struct LexiconNode {
|
|
/* 0000 */ unsigned char value;
|
|
/* 0001 */ unsigned char terminal;
|
|
/* 0002 */ unsigned char unknown_0002[2];
|
|
/* 0004 */ LexiconNode* sibling;
|
|
/* 0008 */ LexiconNode* child;
|
|
};
|
|
|
|
struct LexiconSerializer {
|
|
/* 0000 */ LexiconNode* root;
|
|
/* 0004 */ int wordCount;
|
|
/* 0008 */ int nodeCount;
|
|
/* 000C */ std::uint32_t unknown_000C;
|
|
/* 0010 */ unsigned char* buffer;
|
|
|
|
bool Insert(const unsigned char* word, int length);
|
|
void Destroy(LexiconNode* node);
|
|
std::uint32_t Serialize(LexiconNode* node, std::uint32_t offset, unsigned char terminal);
|
|
};
|
|
|
|
#if defined(_WIN32) && !defined(_WIN64)
|
|
static_assert(sizeof(LexiconNode) == 12);
|
|
#endif
|
|
|
|
#endif
|