diff options
author | bort <bort@yandex-team.ru> | 2022-02-10 16:49:51 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:51 +0300 |
commit | c943ab142d4182af287664691cf116c143172792 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 | |
parent | 3c825ec76d7a17f9817306b93c44845be6a62d58 (diff) | |
download | ydb-c943ab142d4182af287664691cf116c143172792.tar.gz |
Restoring authorship annotation for <bort@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | library/cpp/containers/comptrie/comptrie_builder.inl | 116 | ||||
-rw-r--r-- | library/cpp/containers/comptrie/comptrie_impl.h | 4 | ||||
-rw-r--r-- | library/cpp/http/fetch/exthttpcodes.h | 4 | ||||
-rw-r--r-- | util/generic/ptr.h | 4 |
4 files changed, 64 insertions, 64 deletions
diff --git a/library/cpp/containers/comptrie/comptrie_builder.inl b/library/cpp/containers/comptrie/comptrie_builder.inl index 5194b20ec0..f273fa6571 100644 --- a/library/cpp/containers/comptrie/comptrie_builder.inl +++ b/library/cpp/containers/comptrie/comptrie_builder.inl @@ -46,12 +46,12 @@ protected: }; protected: - void ConvertSymbolArrayToChar(const TSymbol* key, size_t keylen, TTempBuf& buf, size_t ckeylen) const; + void ConvertSymbolArrayToChar(const TSymbol* key, size_t keylen, TTempBuf& buf, size_t ckeylen) const; void NodeLinkTo(TNode* thiz, const TBlob& label, TNode* node); TNode* NodeForwardAdd(TNode* thiz, const char* label, size_t len, size_t& passed, size_t* nodeCount); bool FindEntryImpl(const char* key, size_t keylen, TData* value) const; bool FindLongestPrefixImpl(const char* keyptr, size_t keylen, size_t* prefixLen, TData* value) const; - + size_t NodeMeasureSubtree(TNode* thiz) const; ui64 NodeSaveSubtree(TNode* thiz, IOutputStream& os) const; ui64 NodeSaveSubtreeAndDestroy(TNode* thiz, IOutputStream& osy); @@ -140,7 +140,7 @@ public: iterator Find(char ch); const_iterator Find(char ch) const; - void Add(const TBlob& s, TNode* node); + void Add(const TBlob& s, TNode* node); bool IsLast() const override { return this->Empty(); @@ -504,21 +504,21 @@ TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::~TCompactTrieBuilderImpl( template <class T, class D, class S> void TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::ConvertSymbolArrayToChar( const TSymbol* key, size_t keylen, TTempBuf& buf, size_t buflen) const { - char* ckeyptr = buf.Data(); - - for (size_t i = 0; i < keylen; ++i) { - TSymbol label = key[i]; + char* ckeyptr = buf.Data(); + + for (size_t i = 0; i < keylen; ++i) { + TSymbol label = key[i]; for (int j = (int)NCompactTrie::ExtraBits<TSymbol>(); j >= 0; j -= 8) { Y_ASSERT(ckeyptr < buf.Data() + buflen); - *(ckeyptr++) = (char)(label >> j); - } - } - - buf.Proceed(buflen); + *(ckeyptr++) = (char)(label >> j); + } + } + + buf.Proceed(buflen); Y_ASSERT(ckeyptr == buf.Data() + buf.Filled()); -} - -template <class T, class D, class S> +} + +template <class T, class D, class S> void TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::DestroyNode(TNode* thiz) { thiz->Subtree()->Destroy(this); NodeReleasePayload(thiz); @@ -786,31 +786,31 @@ typename TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::TNode* ythrow yexception() << "Bad input order - expected input strings to be prefix-grouped."; typename TNode::TArcSet::iterator it = arcSet->Find(*label); - + if (it != arcSet->end()) { - const char* arcLabel = it->Label.AsCharPtr(); - size_t arcLabelLen = it->Label.Length(); - - for (passed = 0; (passed < len) && (passed < arcLabelLen) && (label[passed] == arcLabel[passed]); ++passed) { - //just count - } - - if (passed < arcLabelLen) { - (*nodeCount)++; + const char* arcLabel = it->Label.AsCharPtr(); + size_t arcLabelLen = it->Label.Length(); + + for (passed = 0; (passed < len) && (passed < arcLabelLen) && (label[passed] == arcLabel[passed]); ++passed) { + //just count + } + + if (passed < arcLabelLen) { + (*nodeCount)++; TNode* node = new (*NodeAllocator) TNode(); NodeLinkTo(node, it->Label.SubBlob(passed, arcLabelLen), it->Node); - - it->Node = node; - it->Label = it->Label.SubBlob(passed); - } - - return it->Node; - } - + + it->Node = node; + it->Label = it->Label.SubBlob(passed); + } + + return it->Node; + } + return nullptr; -} - -template <class T, class D, class S> +} + +template <class T, class D, class S> void TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::NodeLinkTo(TNode* thiz, const TBlob& label, TNode* node) { typename TNode::TArcSet* arcSet = dynamic_cast<typename TNode::TArcSet*>(thiz->Subtree()); if (!arcSet) @@ -889,7 +889,7 @@ TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::TArc::TArc(const TBlob& l , Node(nd) , LeftOffset(0) , RightOffset(0) -{} +{} template <class T, class D, class S> ui64 TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::ArcMeasure( @@ -901,7 +901,7 @@ ui64 TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::ArcMeasure( if (thiz->Label.Length() > 0) treesize += 2 * (thiz->Label.Length() - 1); - + // Triple measurements are needed because the space needed to store the offset // shall be added to the offset itself. Hence three iterations. size_t leftoffsetsize = leftsize ? MeasureOffset(coresize + treesize) : 0; @@ -929,34 +929,34 @@ ui64 TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::ArcSaveSelf(const TA size_t labelLen = thiz->Label.Length(); - for (size_t i = 0; i < labelLen; ++i) { - char flags = 0; + for (size_t i = 0; i < labelLen; ++i) { + char flags = 0; - if (i == 0) { - flags |= (leftoffsetsize << MT_LEFTSHIFT); - flags |= (rightoffsetsize << MT_RIGHTSHIFT); - } + if (i == 0) { + flags |= (leftoffsetsize << MT_LEFTSHIFT); + flags |= (rightoffsetsize << MT_RIGHTSHIFT); + } - if (i == labelLen-1) { + if (i == labelLen-1) { if (thiz->Node->IsFinal()) - flags |= MT_FINAL; + flags |= MT_FINAL; if (!thiz->Node->IsLast()) - flags |= MT_NEXT; - } else { - flags |= MT_NEXT; - } + flags |= MT_NEXT; + } else { + flags |= MT_NEXT; + } - os.Write(&flags, 1); + os.Write(&flags, 1); os.Write(&thiz->Label.AsCharPtr()[i], 1); written += 2; - if (i == 0) { + if (i == 0) { written += ArcSaveOffset(thiz->LeftOffset, os); written += ArcSaveOffset(thiz->RightOffset, os); - } - } - + } + } + written += NodeSaveLeafValue(thiz->Node, os); return written; } @@ -983,7 +983,7 @@ typename TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::TNode::TArcSet:: using namespace NCompTriePrivate; iterator it = LowerBound(this->begin(), this->end(), ch, TCmp()); - if (it != this->end() && it->Label[0] == (unsigned char)ch) { + if (it != this->end() && it->Label[0] == (unsigned char)ch) { return it; } @@ -1004,9 +1004,9 @@ typename TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::TNode::TArcSet:: } template <class T, class D, class S> -void TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::TNode::TArcSet::Add(const TBlob& s, TNode* node) { +void TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::TNode::TArcSet::Add(const TBlob& s, TNode* node) { using namespace NCompTriePrivate; - this->insert(LowerBound(this->begin(), this->end(), s[0], TCmp()), TArc(s, node)); + this->insert(LowerBound(this->begin(), this->end(), s[0], TCmp()), TArc(s, node)); } template <class T, class D, class S> diff --git a/library/cpp/containers/comptrie/comptrie_impl.h b/library/cpp/containers/comptrie/comptrie_impl.h index cd4953d6dc..f41c38311a 100644 --- a/library/cpp/containers/comptrie/comptrie_impl.h +++ b/library/cpp/containers/comptrie/comptrie_impl.h @@ -78,12 +78,12 @@ namespace NCompTriePrivate { struct TCmp { template <class T> inline bool operator()(const T& l, const T& r) { - return (unsigned char)(l.Label[0]) < (unsigned char)(r.Label[0]); + return (unsigned char)(l.Label[0]) < (unsigned char)(r.Label[0]); } template <class T> inline bool operator()(const T& l, char r) { - return (unsigned char)(l.Label[0]) < (unsigned char)r; + return (unsigned char)(l.Label[0]) < (unsigned char)r; } }; } diff --git a/library/cpp/http/fetch/exthttpcodes.h b/library/cpp/http/fetch/exthttpcodes.h index af4d48c0e9..6b525052cd 100644 --- a/library/cpp/http/fetch/exthttpcodes.h +++ b/library/cpp/http/fetch/exthttpcodes.h @@ -79,7 +79,7 @@ enum ExtHttpCodes { EXT_HTTP_CUSTOM_PARTIAL_CONTENT = 2023, EXT_HTTP_EMPTY_RESPONSE = 2024, EXT_HTTP_REL_CANONICAL = 2025, - + EXT_HTTP_EXT_SUCCESS_END = 3000, // to check if code variable is in success interval EXT_HTTP_HOSTFILTER = 3001, EXT_HTTP_URLFILTER = 3002, @@ -131,7 +131,7 @@ enum HttpFlags { CanBeFake = 2048, }; -const size_t EXT_HTTP_CODE_MAX = 1 << 12; +const size_t EXT_HTTP_CODE_MAX = 1 << 12; static inline int Http2Status(int code) { extern ui16* http2status; diff --git a/util/generic/ptr.h b/util/generic/ptr.h index c7a95dca65..19db0e3ec5 100644 --- a/util/generic/ptr.h +++ b/util/generic/ptr.h @@ -792,7 +792,7 @@ template <class T, class C, class D> class TSharedPtr: public TPointerBase<TSharedPtr<T, C, D>, T> { template <class TT, class CC, class DD> friend class TSharedPtr; - + public: inline TSharedPtr() noexcept : T_(nullptr) @@ -846,7 +846,7 @@ public: { Ref(); } - + template <class TT, class = TGuardConversion<T, TT>> inline TSharedPtr(TSharedPtr<TT, C, D>&& t) noexcept : T_(t.T_) |