MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / Legacy64ExactMatch

Function Legacy64ExactMatch

src/DartsDict.cpp:51–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49};
50
51int Legacy64ExactMatch(const LegacyUnit64* arr, const char* key, size_t len) {
52 size_t pos = 0;
53 for (size_t i = 0; i < len; ++i) {
54 uint64_t c = static_cast<unsigned char>(key[i]);
55 pos ^= static_cast<size_t>(arr[pos].offset() ^ c);
56 if (arr[pos].label() != c) return -1;
57 }
58 if (!arr[pos].has_leaf()) return -1;
59 return arr[pos ^ static_cast<size_t>(arr[pos].offset())].value();
60}
61
62// Returns number of matches found; fills results[] with values (shortest to
63// longest). Mirror of Darts::DoubleArray::commonPrefixSearch value-only form.

Callers 1

MatchMethod · 0.85

Calls 4

offsetMethod · 0.45
labelMethod · 0.45
has_leafMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected