diff options
author | udovichenko-r <udovichenko-r@yandex-team.ru> | 2022-02-10 16:49:21 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:21 +0300 |
commit | d7e4eaec9d325e188dabb3eb1949a32a5229e9ce (patch) | |
tree | 75f143caa4e1e35b760846b22310ede3212d7f63 /library/cpp/containers/comptrie/comptrie_impl.h | |
parent | 027f7b7f6644e258a5840869b9b82c79e1ebeee0 (diff) | |
download | ydb-d7e4eaec9d325e188dabb3eb1949a32a5229e9ce.tar.gz |
Restoring authorship annotation for <udovichenko-r@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/containers/comptrie/comptrie_impl.h')
-rw-r--r-- | library/cpp/containers/comptrie/comptrie_impl.h | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/library/cpp/containers/comptrie/comptrie_impl.h b/library/cpp/containers/comptrie/comptrie_impl.h index f41c38311a..068bed2e6c 100644 --- a/library/cpp/containers/comptrie/comptrie_impl.h +++ b/library/cpp/containers/comptrie/comptrie_impl.h @@ -182,40 +182,40 @@ namespace NCompactTrie { // If there is a value associated with the symbol, makes the value pointer point to it, // otherwise sets it to nullptr. // Returns true if the symbol was succesfully found in the trie, false otherwise. - template <typename TSymbol, class TPacker> + template <typename TSymbol, class TPacker> Y_FORCE_INLINE bool Advance(const char*& datapos, const char* const dataend, const char*& value, TSymbol label, TPacker packer) { Y_ASSERT(datapos < dataend); - char flags = MT_NEXT; - for (int i = (int)ExtraBits<TSymbol>(); i >= 0; i -= 8) { - flags = LeapByte(datapos, dataend, (char)(label >> i)); - if (!datapos) { - return false; // no such arc - } - + char flags = MT_NEXT; + for (int i = (int)ExtraBits<TSymbol>(); i >= 0; i -= 8) { + flags = LeapByte(datapos, dataend, (char)(label >> i)); + if (!datapos) { + return false; // no such arc + } + value = nullptr; - + Y_ASSERT(datapos <= dataend); - if ((flags & MT_FINAL)) { - value = datapos; - datapos += packer.SkipLeaf(datapos); - } - - if (!(flags & MT_NEXT)) { - if (i == 0) { + if ((flags & MT_FINAL)) { + value = datapos; + datapos += packer.SkipLeaf(datapos); + } + + if (!(flags & MT_NEXT)) { + if (i == 0) { datapos = nullptr; - return true; - } - return false; // no further way - } - - TraverseEpsilon(datapos); - if (i == 0) { // last byte, and got a match - return true; - } - } - - return false; - } - + return true; + } + return false; // no further way + } + + TraverseEpsilon(datapos); + if (i == 0) { // last byte, and got a match + return true; + } + } + + return false; + } + } |