aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt
diff options
context:
space:
mode:
authorprime <prime@yandex-team.ru>2022-02-10 16:46:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:01 +0300
commite34f3f0e381020a427f44fbd50463d9a04089db3 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/yt
parent3695a7cd42b74a4987d8d5a8f2e2443556998943 (diff)
downloadydb-e34f3f0e381020a427f44fbd50463d9a04089db3.tar.gz
Restoring authorship annotation for <prime@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yt')
-rw-r--r--library/cpp/yt/memory/blob.cpp28
-rw-r--r--library/cpp/yt/memory/intrusive_ptr.h26
-rw-r--r--library/cpp/yt/memory/weak_ptr.h22
-rw-r--r--library/cpp/yt/misc/guid-inl.h2
-rw-r--r--library/cpp/yt/misc/guid.cpp40
-rw-r--r--library/cpp/yt/misc/guid.h56
-rw-r--r--library/cpp/yt/misc/port.h2
-rw-r--r--library/cpp/yt/misc/variant.h4
-rw-r--r--library/cpp/yt/small_containers/compact_set.h2
-rw-r--r--library/cpp/yt/small_containers/compact_vector-inl.h2
-rw-r--r--library/cpp/yt/small_containers/unittests/compact_flat_map_ut.cpp2
-rw-r--r--library/cpp/yt/string/unittests/guid_ut.cpp28
12 files changed, 107 insertions, 107 deletions
diff --git a/library/cpp/yt/memory/blob.cpp b/library/cpp/yt/memory/blob.cpp
index 5b3be740bf..86000b033b 100644
--- a/library/cpp/yt/memory/blob.cpp
+++ b/library/cpp/yt/memory/blob.cpp
@@ -3,17 +3,17 @@
#include <library/cpp/ytalloc/api/ytalloc.h>
-namespace NYT {
-
-////////////////////////////////////////////////////////////////////////////////
-
+namespace NYT {
+
+////////////////////////////////////////////////////////////////////////////////
+
static constexpr size_t InitialBlobCapacity = 16;
static constexpr double BlobCapacityMultiplier = 1.5;
-TBlob::TBlob(
- TRefCountedTypeCookie tagCookie,
- size_t size,
- bool initiailizeStorage,
+TBlob::TBlob(
+ TRefCountedTypeCookie tagCookie,
+ size_t size,
+ bool initiailizeStorage,
bool pageAligned)
: PageAligned_(pageAligned)
{
@@ -29,8 +29,8 @@ TBlob::TBlob(
}
}
-TBlob::TBlob(
- TRefCountedTypeCookie tagCookie,
+TBlob::TBlob(
+ TRefCountedTypeCookie tagCookie,
TRef data,
bool pageAligned)
: PageAligned_(pageAligned)
@@ -97,8 +97,8 @@ void TBlob::Resize(size_t newSize, bool initializeStorage /*= true*/)
TBlob& TBlob::operator = (const TBlob& rhs)
{
if (this != &rhs) {
- this->~TBlob();
- new(this) TBlob(rhs);
+ this->~TBlob();
+ new(this) TBlob(rhs);
}
return *this;
}
@@ -106,8 +106,8 @@ TBlob& TBlob::operator = (const TBlob& rhs)
TBlob& TBlob::operator = (TBlob&& rhs) noexcept
{
if (this != &rhs) {
- this->~TBlob();
- new(this) TBlob(std::move(rhs));
+ this->~TBlob();
+ new(this) TBlob(std::move(rhs));
}
return *this;
}
diff --git a/library/cpp/yt/memory/intrusive_ptr.h b/library/cpp/yt/memory/intrusive_ptr.h
index c250083957..3dead7db1d 100644
--- a/library/cpp/yt/memory/intrusive_ptr.h
+++ b/library/cpp/yt/memory/intrusive_ptr.h
@@ -6,7 +6,7 @@
#include <util/generic/utility.h>
#include <utility>
-#include <type_traits>
+#include <type_traits>
namespace NYT {
@@ -21,7 +21,7 @@ public:
constexpr TIntrusivePtr() noexcept
{ }
- constexpr TIntrusivePtr(std::nullptr_t) noexcept
+ constexpr TIntrusivePtr(std::nullptr_t) noexcept
{ }
//! Constructor from an unqualified reference.
@@ -50,7 +50,7 @@ public:
}
//! Copy constructor with an upcast.
- template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>
+ template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>
TIntrusivePtr(const TIntrusivePtr<U>& other) noexcept
: T_(other.Get())
{
@@ -70,7 +70,7 @@ public:
}
//! Move constructor with an upcast.
- template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>
+ template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>
TIntrusivePtr(TIntrusivePtr<U>&& other) noexcept
: T_(other.Get())
{
@@ -100,7 +100,7 @@ public:
TIntrusivePtr& operator=(const TIntrusivePtr<U>& other) noexcept
{
static_assert(
- std::is_convertible_v<U*, T*>,
+ std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
static_assert(
std::is_base_of_v<TRefCountedBase, T>,
@@ -121,7 +121,7 @@ public:
TIntrusivePtr& operator=(TIntrusivePtr<U>&& other) noexcept
{
static_assert(
- std::is_convertible_v<U*, T*>,
+ std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
static_assert(
std::is_base_of_v<TRefCountedBase, T>,
@@ -271,7 +271,7 @@ template <class T, class U>
bool operator==(const TIntrusivePtr<T>& lhs, const TIntrusivePtr<U>& rhs)
{
static_assert(
- std::is_convertible_v<U*, T*>,
+ std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
return lhs.Get() == rhs.Get();
}
@@ -280,7 +280,7 @@ template <class T, class U>
bool operator!=(const TIntrusivePtr<T>& lhs, const TIntrusivePtr<U>& rhs)
{
static_assert(
- std::is_convertible_v<U*, T*>,
+ std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
return lhs.Get() != rhs.Get();
}
@@ -289,7 +289,7 @@ template <class T, class U>
bool operator==(const TIntrusivePtr<T>& lhs, U* rhs)
{
static_assert(
- std::is_convertible_v<U*, T*>,
+ std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
return lhs.Get() == rhs;
}
@@ -298,7 +298,7 @@ template <class T, class U>
bool operator!=(const TIntrusivePtr<T>& lhs, U* rhs)
{
static_assert(
- std::is_convertible_v<U*, T*>,
+ std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
return lhs.Get() != rhs;
}
@@ -307,7 +307,7 @@ template <class T, class U>
bool operator==(T* lhs, const TIntrusivePtr<U>& rhs)
{
static_assert(
- std::is_convertible_v<U*, T*>,
+ std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
return lhs == rhs.Get();
}
@@ -316,7 +316,7 @@ template <class T, class U>
bool operator!=(T* lhs, const TIntrusivePtr<U>& rhs)
{
static_assert(
- std::is_convertible_v<U*, T*>,
+ std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
return lhs != rhs.Get();
}
@@ -351,7 +351,7 @@ bool operator!=(const TIntrusivePtr<T>& lhs, std::nullptr_t)
//! A hasher for TIntrusivePtr.
template <class T>
-struct THash<NYT::TIntrusivePtr<T>>
+struct THash<NYT::TIntrusivePtr<T>>
{
Y_FORCE_INLINE size_t operator () (const NYT::TIntrusivePtr<T>& ptr) const
{
diff --git a/library/cpp/yt/memory/weak_ptr.h b/library/cpp/yt/memory/weak_ptr.h
index b4650930a5..25a242bb8a 100644
--- a/library/cpp/yt/memory/weak_ptr.h
+++ b/library/cpp/yt/memory/weak_ptr.h
@@ -43,7 +43,7 @@ public:
{ }
//! Constructor from a strong reference with an upcast.
- template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>
+ template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>
TWeakPtr(const TIntrusivePtr<U>& ptr) noexcept
: TWeakPtr(ptr.Get())
{
@@ -58,7 +58,7 @@ public:
{ }
//! Copy constructor with an upcast.
- template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>
+ template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>
TWeakPtr(const TWeakPtr<U>& other) noexcept
: TWeakPtr(other.Lock())
{
@@ -74,7 +74,7 @@ public:
}
//! Move constructor with an upcast.
- template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>
+ template <class U, class = typename std::enable_if_t<std::is_convertible_v<U*, T*>>>
TWeakPtr(TWeakPtr<U>&& other) noexcept
{
static_assert(
@@ -103,7 +103,7 @@ public:
TWeakPtr& operator=(const TIntrusivePtr<U>& ptr) noexcept
{
static_assert(
- std::is_convertible_v<U*, T*>,
+ std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
TWeakPtr(ptr).Swap(*this);
return *this;
@@ -121,7 +121,7 @@ public:
TWeakPtr& operator=(const TWeakPtr<U>& other) noexcept
{
static_assert(
- std::is_convertible_v<U*, T*>,
+ std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
TWeakPtr(other).Swap(*this);
return *this;
@@ -139,7 +139,7 @@ public:
TWeakPtr& operator=(TWeakPtr<U>&& other) noexcept
{
static_assert(
- std::is_convertible_v<U*, T*>,
+ std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
TWeakPtr(std::move(other)).Swap(*this);
return *this;
@@ -162,7 +162,7 @@ public:
void Reset(const TIntrusivePtr<U>& ptr) // noexcept
{
static_assert(
- std::is_convertible_v<U*, T*>,
+ std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
TWeakPtr(ptr).Swap(*this);
}
@@ -210,7 +210,7 @@ private:
template <class U>
friend class TWeakPtr;
template <class U>
- friend struct ::THash;
+ friend struct ::THash;
T* T_ = nullptr;
#if defined(_tsan_enabled_)
@@ -284,7 +284,7 @@ template <class T, class U>
bool operator==(const TWeakPtr<T>& lhs, const TWeakPtr<U>& rhs)
{
static_assert(
- std::is_convertible_v<U*, T*>,
+ std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
return lhs.Lock().Get() == rhs.Lock().Get();
}
@@ -293,7 +293,7 @@ template <class T, class U>
bool operator!=(const TWeakPtr<T>& lhs, const TWeakPtr<U>& rhs)
{
static_assert(
- std::is_convertible_v<U*, T*>,
+ std::is_convertible_v<U*, T*>,
"U* must be convertible to T*");
return lhs.Lock().Get() != rhs.Lock().Get();
}
@@ -305,7 +305,7 @@ bool operator!=(const TWeakPtr<T>& lhs, const TWeakPtr<U>& rhs)
//! A hasher for TWeakPtr.
template <class T>
-struct THash<NYT::TWeakPtr<T>>
+struct THash<NYT::TWeakPtr<T>>
{
size_t operator () (const NYT::TWeakPtr<T>& ptr) const
{
diff --git a/library/cpp/yt/misc/guid-inl.h b/library/cpp/yt/misc/guid-inl.h
index 472457eb6d..2d94b5701b 100644
--- a/library/cpp/yt/misc/guid-inl.h
+++ b/library/cpp/yt/misc/guid-inl.h
@@ -66,7 +66,7 @@ Y_FORCE_INLINE bool operator < (TGuid lhs, TGuid rhs)
} // namespace NYT
-Y_FORCE_INLINE size_t THash<NYT::TGuid>::operator()(const NYT::TGuid& guid) const
+Y_FORCE_INLINE size_t THash<NYT::TGuid>::operator()(const NYT::TGuid& guid) const
{
const size_t p = 1000000009; // prime number
return guid.Parts32[0] +
diff --git a/library/cpp/yt/misc/guid.cpp b/library/cpp/yt/misc/guid.cpp
index 501b9630cb..882787d7a2 100644
--- a/library/cpp/yt/misc/guid.cpp
+++ b/library/cpp/yt/misc/guid.cpp
@@ -115,28 +115,28 @@ bool TGuid::FromStringHex32(TStringBuf str, TGuid* result)
return false;
}
- bool ok = true;
- int i = 0;
- auto parseChar = [&] {
- const char c = str[i++];
- ui32 digit = 0;
- if ('0' <= c && c <= '9') {
- digit = c - '0';
- } else if ('a' <= c && c <= 'f') {
- digit = c - 'a' + 10;
- } else if ('A' <= c && c <= 'F') {
- digit = c - 'A' + 10;
- } else {
- ok = false;
- }
- return digit;
- };
-
- for (size_t j = 0; j < 16; ++j) {
- result->ReversedParts8[15 - j] = parseChar() * 16 + parseChar();
+ bool ok = true;
+ int i = 0;
+ auto parseChar = [&] {
+ const char c = str[i++];
+ ui32 digit = 0;
+ if ('0' <= c && c <= '9') {
+ digit = c - '0';
+ } else if ('a' <= c && c <= 'f') {
+ digit = c - 'a' + 10;
+ } else if ('A' <= c && c <= 'F') {
+ digit = c - 'A' + 10;
+ } else {
+ ok = false;
+ }
+ return digit;
+ };
+
+ for (size_t j = 0; j < 16; ++j) {
+ result->ReversedParts8[15 - j] = parseChar() * 16 + parseChar();
}
- return ok;
+ return ok;
}
char* WriteGuidToBuffer(char* ptr, TGuid value)
diff --git a/library/cpp/yt/misc/guid.h b/library/cpp/yt/misc/guid.h
index e202e1e679..ec4ba3526a 100644
--- a/library/cpp/yt/misc/guid.h
+++ b/library/cpp/yt/misc/guid.h
@@ -9,39 +9,39 @@ namespace NYT {
////////////////////////////////////////////////////////////////////////////////
-//! TGuid is 16-byte value that might be interpreted as four little-endian 32-bit integers or two 64-bit little-endian integers.
-/*!
- * *-------------------------*-------------------------*
- * | Parts64[0] | Parts64[1] |
- * *------------*------------*------------*------------*
- * | Parts32[0] | Parts32[1] | Parts32[2] | Parts32[3] |
- * *------------*------------*------------*------------*
- * | 15..............................................0 |
- * *---------------------------------------------------*
- *
- * Note, that bytes are kept in memory in reverse order.
- *
- * Canonical text representation of guid consists of four base-16 numbers.
- * In text form, Parts32[3] comes first, and Parts32[0] comes last.
- *
- * For example:
- *
- * xxyyzzaa-0-1234-ff
- *
- * xx is byte [0]
- * yy is byte [1]
- * zz is byte [2]
- * 12 is byte [8]
- * 34 is byte [9]
- * ff is byte [15]
- */
+//! TGuid is 16-byte value that might be interpreted as four little-endian 32-bit integers or two 64-bit little-endian integers.
+/*!
+ * *-------------------------*-------------------------*
+ * | Parts64[0] | Parts64[1] |
+ * *------------*------------*------------*------------*
+ * | Parts32[0] | Parts32[1] | Parts32[2] | Parts32[3] |
+ * *------------*------------*------------*------------*
+ * | 15..............................................0 |
+ * *---------------------------------------------------*
+ *
+ * Note, that bytes are kept in memory in reverse order.
+ *
+ * Canonical text representation of guid consists of four base-16 numbers.
+ * In text form, Parts32[3] comes first, and Parts32[0] comes last.
+ *
+ * For example:
+ *
+ * xxyyzzaa-0-1234-ff
+ *
+ * xx is byte [0]
+ * yy is byte [1]
+ * zz is byte [2]
+ * 12 is byte [8]
+ * 34 is byte [9]
+ * ff is byte [15]
+ */
struct TGuid
{
union
{
ui32 Parts32[4];
ui64 Parts64[2];
- ui8 ReversedParts8[16];
+ ui8 ReversedParts8[16];
};
//! Constructs a null (zero) guid.
@@ -97,7 +97,7 @@ Y_DECLARE_PODTYPE(NYT::TGuid);
//! A hasher for TGuid.
template <>
-struct THash<NYT::TGuid>
+struct THash<NYT::TGuid>
{
size_t operator()(const NYT::TGuid& guid) const;
};
diff --git a/library/cpp/yt/misc/port.h b/library/cpp/yt/misc/port.h
index 88335abf40..b24ac50995 100644
--- a/library/cpp/yt/misc/port.h
+++ b/library/cpp/yt/misc/port.h
@@ -32,7 +32,7 @@
#endif
// Configure SSE usage.
-#ifdef SSE42_ENABLED
+#ifdef SSE42_ENABLED
#define YT_USE_SSE42
#endif
diff --git a/library/cpp/yt/misc/variant.h b/library/cpp/yt/misc/variant.h
index a1fd8bedf1..27c0a2bc08 100644
--- a/library/cpp/yt/misc/variant.h
+++ b/library/cpp/yt/misc/variant.h
@@ -31,9 +31,9 @@ class TStringBuilderBase;
template <class... Ts>
void FormatValue(TStringBuilderBase* builder, const std::variant<Ts...>& variant, TStringBuf spec);
-template <class... Ts>
+template <class... Ts>
TString ToString(const std::variant<Ts...>& variant);
-
+
////////////////////////////////////////////////////////////////////////////////
//! A concise way of creating a functor with an overloaded operator().
diff --git a/library/cpp/yt/small_containers/compact_set.h b/library/cpp/yt/small_containers/compact_set.h
index eb35a2df51..2ca8713ea7 100644
--- a/library/cpp/yt/small_containers/compact_set.h
+++ b/library/cpp/yt/small_containers/compact_set.h
@@ -50,7 +50,7 @@ public:
TCompactSet() {}
[[nodiscard]] bool empty() const;
-
+
size_type size() const;
const T& front() const;
diff --git a/library/cpp/yt/small_containers/compact_vector-inl.h b/library/cpp/yt/small_containers/compact_vector-inl.h
index d712f5a8fe..52507e4768 100644
--- a/library/cpp/yt/small_containers/compact_vector-inl.h
+++ b/library/cpp/yt/small_containers/compact_vector-inl.h
@@ -734,7 +734,7 @@ void TCompactVector<T, N>::EnsureOnHeapCapacity(size_t newCapacity, bool increme
}
auto byteSize = sizeof(TOnHeapStorage) + newCapacity * sizeof(T);
- byteSize = nallocx(byteSize, 0);
+ byteSize = nallocx(byteSize, 0);
newCapacity = (byteSize - sizeof(TOnHeapStorage)) / sizeof(T);
diff --git a/library/cpp/yt/small_containers/unittests/compact_flat_map_ut.cpp b/library/cpp/yt/small_containers/unittests/compact_flat_map_ut.cpp
index 012f31195f..0b2f290692 100644
--- a/library/cpp/yt/small_containers/unittests/compact_flat_map_ut.cpp
+++ b/library/cpp/yt/small_containers/unittests/compact_flat_map_ut.cpp
@@ -1,4 +1,4 @@
-#include <yt/yt/core/test_framework/framework.h>
+#include <yt/yt/core/test_framework/framework.h>
#include <yt/yt/core/misc/compact_flat_map.h>
diff --git a/library/cpp/yt/string/unittests/guid_ut.cpp b/library/cpp/yt/string/unittests/guid_ut.cpp
index 629f56ff1a..4b5eebea16 100644
--- a/library/cpp/yt/string/unittests/guid_ut.cpp
+++ b/library/cpp/yt/string/unittests/guid_ut.cpp
@@ -3,8 +3,8 @@
#include <library/cpp/yt/string/guid.h>
#include <library/cpp/yt/string/format.h>
-#include <util/string/hex.h>
-
+#include <util/string/hex.h>
+
namespace NYT {
namespace {
@@ -21,10 +21,10 @@ TString CanonicalToString(TGuid value)
value.Parts32[0]);
}
-const ui32 TrickyValues[] = {
- 0, 0x1, 0x12, 0x123, 0x1234, 0x12345, 0x123456, 0x1234567, 0x12345678
-};
-
+const ui32 TrickyValues[] = {
+ 0, 0x1, 0x12, 0x123, 0x1234, 0x12345, 0x123456, 0x1234567, 0x12345678
+};
+
TEST(TGuidTest, FormatAllTricky)
{
for (ui32 a : TrickyValues) {
@@ -44,14 +44,14 @@ TEST(TGuidTest, FormatAllSymbols)
const auto Value = TGuid::FromString("12345678-abcdef01-12345678-abcdef01");
EXPECT_EQ(CanonicalToString(Value), ToString(Value));
}
-
-TEST(TGuidTest, ByteOrder)
-{
- auto guid = TGuid::FromStringHex32("12345678ABCDEF0112345678ABCDEF01");
- TString bytes{reinterpret_cast<const char*>(&(guid.Parts32[0])), 16};
- EXPECT_EQ(HexEncode(bytes), "01EFCDAB7856341201EFCDAB78563412");
-}
-
+
+TEST(TGuidTest, ByteOrder)
+{
+ auto guid = TGuid::FromStringHex32("12345678ABCDEF0112345678ABCDEF01");
+ TString bytes{reinterpret_cast<const char*>(&(guid.Parts32[0])), 16};
+ EXPECT_EQ(HexEncode(bytes), "01EFCDAB7856341201EFCDAB78563412");
+}
+
////////////////////////////////////////////////////////////////////////////////
} // namespace