am fe9dca7e: Merge "Read multi-byte char group counts"
* commit 'fe9dca7ec3814956e6e545c383106156f568d047': Read multi-byte char group countsmain
commit
06f2692c78
|
@ -61,7 +61,9 @@ inline int BinaryFormat::detectFormat(const uint8_t* const dict) {
|
|||
}
|
||||
|
||||
inline int BinaryFormat::getGroupCountAndForwardPointer(const uint8_t* const dict, int* pos) {
|
||||
return dict[(*pos)++];
|
||||
const int msb = dict[(*pos)++];
|
||||
if (msb < 0x80) return msb;
|
||||
return ((msb & 0x7F) << 8) | dict[(*pos)++];
|
||||
}
|
||||
|
||||
inline uint8_t BinaryFormat::getFlagsAndForwardPointer(const uint8_t* const dict, int* pos) {
|
||||
|
|
|
@ -507,9 +507,10 @@ int UnigramDictionary::getMostFrequentWordLikeInner(const uint16_t * const inWor
|
|||
int maxFreq = -1;
|
||||
const uint8_t* const root = DICT_ROOT;
|
||||
|
||||
mStackChildCount[0] = root[0];
|
||||
int startPos = 0;
|
||||
mStackChildCount[0] = BinaryFormat::getGroupCountAndForwardPointer(root, &startPos);
|
||||
mStackInputIndex[0] = 0;
|
||||
mStackSiblingPos[0] = 1;
|
||||
mStackSiblingPos[0] = startPos;
|
||||
while (depth >= 0) {
|
||||
const int charGroupCount = mStackChildCount[depth];
|
||||
int pos = mStackSiblingPos[depth];
|
||||
|
|
Loading…
Reference in New Issue