diff options
author | udovichenko-r <udovichenko-r@yandex-team.ru> | 2022-02-10 16:49:22 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:22 +0300 |
commit | a6f6b22bda21d53d07bd2e0ff63a2b2abf69ede9 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/containers/comptrie/comptrie_trie.h | |
parent | d7e4eaec9d325e188dabb3eb1949a32a5229e9ce (diff) | |
download | ydb-a6f6b22bda21d53d07bd2e0ff63a2b2abf69ede9.tar.gz |
Restoring authorship annotation for <udovichenko-r@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/containers/comptrie/comptrie_trie.h')
-rw-r--r-- | library/cpp/containers/comptrie/comptrie_trie.h | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/library/cpp/containers/comptrie/comptrie_trie.h b/library/cpp/containers/comptrie/comptrie_trie.h index ffba10ae40..40ec1e52b3 100644 --- a/library/cpp/containers/comptrie/comptrie_trie.h +++ b/library/cpp/containers/comptrie/comptrie_trie.h @@ -139,7 +139,7 @@ public: // same as FindTails(&key, 1), a bit faster // return false, if no arc with @label exists - inline bool FindTails(TSymbol label, TCompactTrie<T, D, S>& res) const; + inline bool FindTails(TSymbol label, TCompactTrie<T, D, S>& res) const; class TConstIterator { private: @@ -361,28 +361,28 @@ bool TCompactTrie<T, D, S>::FindTails(const TSymbol* key, size_t keylen, TCompac return true; } - const char* datastart = DataHolder.AsCharPtr(); - const char* datapos = datastart; - const char* const dataend = datapos + len; - + const char* datastart = DataHolder.AsCharPtr(); + const char* datapos = datastart; + const char* const dataend = datapos + len; + const TSymbol* keyend = key + keylen; const char* value = nullptr; - + while (key != keyend) { T label = *(key++); - if (!NCompactTrie::Advance(datapos, dataend, value, label, Packer)) - return false; + if (!NCompactTrie::Advance(datapos, dataend, value, label, Packer)) + return false; - if (key == keyend) { - if (datapos) { + if (key == keyend) { + if (datapos) { Y_ASSERT(datapos >= datastart); res = TCompactTrie<T, D, S>(TBlob::NoCopy(datapos, dataend - datapos), value); - } else { - res = TCompactTrie<T, D, S>(value); + } else { + res = TCompactTrie<T, D, S>(value); } - return true; - } else if (!datapos) { - return false; // No further way + return true; + } else if (!datapos) { + return false; // No further way } } @@ -390,7 +390,7 @@ bool TCompactTrie<T, D, S>::FindTails(const TSymbol* key, size_t keylen, TCompac } template <class T, class D, class S> -inline bool TCompactTrie<T, D, S>::FindTails(TSymbol label, TCompactTrie<T, D, S>& res) const { +inline bool TCompactTrie<T, D, S>::FindTails(TSymbol label, TCompactTrie<T, D, S>& res) const { using namespace NCompactTrie; const size_t len = DataHolder.Length(); @@ -402,17 +402,17 @@ inline bool TCompactTrie<T, D, S>::FindTails(TSymbol label, TCompactTrie<T, D, S const char* datapos = datastart; const char* value = nullptr; - if (!NCompactTrie::Advance(datapos, dataend, value, label, Packer)) - return false; + if (!NCompactTrie::Advance(datapos, dataend, value, label, Packer)) + return false; - if (datapos) { + if (datapos) { Y_ASSERT(datapos >= datastart); - res = TCompactTrie<T, D, S>(TBlob::NoCopy(datapos, dataend - datapos), value); - } else { - res = TCompactTrie<T, D, S>(value); + res = TCompactTrie<T, D, S>(TBlob::NoCopy(datapos, dataend - datapos), value); + } else { + res = TCompactTrie<T, D, S>(value); } - return true; + return true; } template <class T, class D, class S> |