diff options
author | Andrey Khalyavin <halyavin@gmail.com> | 2022-02-10 16:46:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:30 +0300 |
commit | 4b839d0704ee9be1dabb0310a1f03af24963637b (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util | |
parent | f773626848a7c7456803654292e716b83d69cc12 (diff) | |
download | ydb-4b839d0704ee9be1dabb0310a1f03af24963637b.tar.gz |
Restoring authorship annotation for Andrey Khalyavin <halyavin@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util')
35 files changed, 254 insertions, 254 deletions
diff --git a/util/charset/unicode_table.h b/util/charset/unicode_table.h index 944c567ade..9e171b2583 100644 --- a/util/charset/unicode_table.h +++ b/util/charset/unicode_table.h @@ -41,7 +41,7 @@ namespace NUnicodeTable { using TData = const TValuePtr*; static inline TValuePtr Get(TData table, size_t index) { - static_assert(std::is_pointer<TData>::value, "expect std::is_pointer<TData>::value"); + static_assert(std::is_pointer<TData>::value, "expect std::is_pointer<TData>::value"); return table[index]; } @@ -58,7 +58,7 @@ namespace NUnicodeTable { using TData = const typename TChild::TData*; static inline TValuePtr Get(TData table, size_t key) { - static_assert(std::is_pointer<TData>::value, "expect std::is_pointer<TData>::value"); + static_assert(std::is_pointer<TData>::value, "expect std::is_pointer<TData>::value"); return TChild::Get(table[key >> Shift], key & ((1 << Shift) - 1)); } @@ -97,7 +97,7 @@ namespace NUnicodeTable { : Data(data) , MSize(size) { - static_assert(std::is_pointer<TData>::value, "expect std::is_pointer<TData>::value"); + static_assert(std::is_pointer<TData>::value, "expect std::is_pointer<TData>::value"); } inline TValueRef Get(size_t key, TValueRef value) const { diff --git a/util/charset/wide.h b/util/charset/wide.h index d6d82aa7ad..04e6928aab 100644 --- a/util/charset/wide.h +++ b/util/charset/wide.h @@ -146,7 +146,7 @@ inline wchar32 ReadSymbolAndAdvance(const wchar32*& begin, const wchar32* end) n template <class T> inline size_t WriteSymbol(wchar16 s, T& dest) noexcept { - ::NDetail::TSelector<std::is_pointer<T>::value>::WriteSymbol(s, dest); + ::NDetail::TSelector<std::is_pointer<T>::value>::WriteSymbol(s, dest); return 1; } diff --git a/util/datetime/parser.rl6 b/util/datetime/parser.rl6 index af805aa218..931f09eae1 100644 --- a/util/datetime/parser.rl6 +++ b/util/datetime/parser.rl6 @@ -6,7 +6,7 @@ #include <numeric> #include <util/datetime/parser.h> -#include <util/generic/ymath.h> +#include <util/generic/ymath.h> %%{ @@ -775,8 +775,8 @@ bool TDurationParser::ParsePart(const char* input, size_t len) { static inline ui64 DecPower(ui64 part, i32 power) { if (power >= 0) - return part * Power(10, power); - return part / Power(10, -power); + return part * Power(10, power); + return part / Power(10, -power); } TDuration TDurationParser::GetResult(TDuration defaultValue) const { diff --git a/util/draft/ut/ya.make b/util/draft/ut/ya.make index fd330b2fe7..37ab9413c5 100644 --- a/util/draft/ut/ya.make +++ b/util/draft/ut/ya.make @@ -1,10 +1,10 @@ -UNITTEST() +UNITTEST() OWNER(g:util) SUBSCRIBER(g:util-subscribers) -SRCDIR(util/draft) - +SRCDIR(util/draft) + PEERDIR( util/draft ) diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp index 9d1942769d..8d732fcc0c 100644 --- a/util/generic/algorithm_ut.cpp +++ b/util/generic/algorithm_ut.cpp @@ -845,6 +845,6 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { Y_UNIT_TEST(AccumulateWithBinOp) { std::vector<int> v = {1, 2, 777}; - UNIT_ASSERT_VALUES_EQUAL(TString("begin;1;2;777"), Accumulate(v, TString("begin"), [](auto&& a, auto& b) { return a + ";" + ToString(b); })); + UNIT_ASSERT_VALUES_EQUAL(TString("begin;1;2;777"), Accumulate(v, TString("begin"), [](auto&& a, auto& b) { return a + ";" + ToString(b); })); } }; diff --git a/util/generic/bitmap.h b/util/generic/bitmap.h index 8289cf18a8..f77d182460 100644 --- a/util/generic/bitmap.h +++ b/util/generic/bitmap.h @@ -315,7 +315,7 @@ public: using TThis = TBitMapOps<TTraits>; private: - static_assert(std::is_unsigned<TChunk>::value, "expect std::is_unsigned<TChunk>::value"); + static_assert(std::is_unsigned<TChunk>::value, "expect std::is_unsigned<TChunk>::value"); static constexpr size_t BitsPerChunk = 8 * sizeof(TChunk); static constexpr TChunk ModMask = static_cast<TChunk>(BitsPerChunk - 1); @@ -567,7 +567,7 @@ public: template <class TTo> void Export(size_t pos, TTo& to) const { - static_assert(std::is_unsigned<TTo>::value, "expect std::is_unsigned<TTo>::value"); + static_assert(std::is_unsigned<TTo>::value, "expect std::is_unsigned<TTo>::value"); to = 0; size_t chunkpos = pos >> DivCount; if (chunkpos >= Mask.GetChunkCapacity()) diff --git a/util/generic/cast.h b/util/generic/cast.h index 69bfdf4102..0d4a41f385 100644 --- a/util/generic/cast.h +++ b/util/generic/cast.h @@ -84,7 +84,7 @@ public: template <class TType> constexpr bool IsNegative(const TType value) noexcept { - return TInteger<std::is_unsigned<TType>::value>::IsNegative(value); + return TInteger<std::is_unsigned<TType>::value>::IsNegative(value); } namespace NPrivate { @@ -116,7 +116,7 @@ inline std::enable_if_t<!::NPrivate::TSafelyConvertible<TSmall, TLarge>::Result, using TSmallInt = ::NPrivate::TUnderlyingTypeOrSelf<TSmall>; using TLargeInt = ::NPrivate::TUnderlyingTypeOrSelf<TLarge>; - if (std::is_unsigned<TSmallInt>::value && std::is_signed<TLargeInt>::value) { + if (std::is_unsigned<TSmallInt>::value && std::is_signed<TLargeInt>::value) { if (IsNegative(largeInt)) { ythrow TBadCastException() << "Conversion '" << TypeName<TLarge>() << '{' << TLargeInt(largeInt) << "}' to '" << TypeName<TSmallInt>() @@ -126,7 +126,7 @@ inline std::enable_if_t<!::NPrivate::TSafelyConvertible<TSmall, TLarge>::Result, TSmallInt smallInt = TSmallInt(largeInt); - if (std::is_signed<TSmallInt>::value && std::is_unsigned<TLargeInt>::value) { + if (std::is_signed<TSmallInt>::value && std::is_unsigned<TLargeInt>::value) { if (IsNegative(smallInt)) { ythrow TBadCastException() << "Conversion '" << TypeName<TLarge>() << '{' << TLargeInt(largeInt) << "}' to '" << TypeName<TSmallInt>() diff --git a/util/generic/fwd.h b/util/generic/fwd.h index ab350d1abc..5cc2da40e5 100644 --- a/util/generic/fwd.h +++ b/util/generic/fwd.h @@ -64,10 +64,10 @@ class TQueue; template <class T, class S = TVector<T>, class C = TLess<T>> class TPriorityQueue; -template <class Key, class T, class HashFcn = THash<Key>, class EqualKey = TEqualTo<Key>, class Alloc = std::allocator<Key>> +template <class Key, class T, class HashFcn = THash<Key>, class EqualKey = TEqualTo<Key>, class Alloc = std::allocator<Key>> class THashMap; -template <class Key, class T, class HashFcn = THash<Key>, class EqualKey = TEqualTo<Key>, class Alloc = std::allocator<Key>> +template <class Key, class T, class HashFcn = THash<Key>, class EqualKey = TEqualTo<Key>, class Alloc = std::allocator<Key>> class THashMultiMap; template <class Value, class HashFcn = THash<Value>, class EqualKey = TEqualTo<Value>, class Alloc = std::allocator<Value>> diff --git a/util/generic/hash.h b/util/generic/hash.h index 8790b15e1a..e46db21fa9 100644 --- a/util/generic/hash.h +++ b/util/generic/hash.h @@ -3,7 +3,7 @@ #include "fwd.h" #include "mapfindptr.h" -#include <util/memory/alloc.h> +#include <util/memory/alloc.h> #include <util/system/type_name.h> #include <util/system/yassert.h> #include <util/str_stl.h> @@ -347,7 +347,7 @@ private: * Note that there are no specializations for the case when only one or two * of the functors are empty as this is a case that's just way too rare. */ -template <class HashFcn, class ExtractKey, class EqualKey, class Alloc, bool IsEmpty = std::is_empty<HashFcn>::value&& std::is_empty<ExtractKey>::value&& std::is_empty<EqualKey>::value> +template <class HashFcn, class ExtractKey, class EqualKey, class Alloc, bool IsEmpty = std::is_empty<HashFcn>::value&& std::is_empty<ExtractKey>::value&& std::is_empty<EqualKey>::value> class _yhashtable_base: public _allocator_base<Alloc> { using base_type = _allocator_base<Alloc>; @@ -440,8 +440,8 @@ template <class Value, class Key, class HashFcn, class ExtractKey, class EqualKe struct _yhashtable_traits { using node = __yhashtable_node<Value>; - using node_allocator_type = TReboundAllocator<Alloc, node>; - using nodep_allocator_type = TReboundAllocator<Alloc, node*>; + using node_allocator_type = TReboundAllocator<Alloc, node>; + using nodep_allocator_type = TReboundAllocator<Alloc, node*>; using base_type = _yhashtable_base<HashFcn, ExtractKey, EqualKey, node_allocator_type>; }; diff --git a/util/generic/map.h b/util/generic/map.h index a43c8eca4e..b5001b56c0 100644 --- a/util/generic/map.h +++ b/util/generic/map.h @@ -13,7 +13,7 @@ template <class K, class V, class Less, class A> class TMap: public std::map<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>>, public TMapOps<TMap<K, V, Less, A>> { - using TBase = std::map<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>>; + using TBase = std::map<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>>; public: using TBase::TBase; @@ -29,7 +29,7 @@ public: template <class K, class V, class Less, class A> class TMultiMap: public std::multimap<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>> { - using TBase = std::multimap<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>>; + using TBase = std::multimap<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>>; public: using TBase::TBase; diff --git a/util/generic/map_ut.cpp b/util/generic/map_ut.cpp index d82db9a4f8..79e832b024 100644 --- a/util/generic/map_ut.cpp +++ b/util/generic/map_ut.cpp @@ -254,8 +254,8 @@ Y_UNIT_TEST_SUITE(TYMapTest) { bool operator()(int lhs, TKey rhs) const { return lhs < rhs.m_data; } - - using is_transparent = void; + + using is_transparent = void; }; struct TKeyCmpPtr { @@ -270,8 +270,8 @@ Y_UNIT_TEST_SUITE(TYMapTest) { bool operator()(int lhs, TKey const volatile* rhs) const { return lhs < (*rhs).m_data; } - - using is_transparent = void; + + using is_transparent = void; }; Y_UNIT_TEST(TestTemplateMethods) { diff --git a/util/generic/maybe_traits.h b/util/generic/maybe_traits.h index 808e597971..9e9f56955e 100644 --- a/util/generic/maybe_traits.h +++ b/util/generic/maybe_traits.h @@ -1,6 +1,6 @@ #pragma once -#include <memory> +#include <memory> #include <type_traits> #include <initializer_list> diff --git a/util/generic/ptr.h b/util/generic/ptr.h index 22f22787ba..19db0e3ec5 100644 --- a/util/generic/ptr.h +++ b/util/generic/ptr.h @@ -1080,7 +1080,7 @@ public: return T_.Get(); } - inline T* Mutable() { + inline T* Mutable() { Unshare(); return T_.Get(); @@ -1109,7 +1109,7 @@ public: } #endif private: - inline void Unshare() { + inline void Unshare() { if (Shared()) { Reset(TCopy::Copy(T_.Get())); } diff --git a/util/generic/set_ut.cpp b/util/generic/set_ut.cpp index 5fd8505a71..d2769d327f 100644 --- a/util/generic/set_ut.cpp +++ b/util/generic/set_ut.cpp @@ -289,8 +289,8 @@ Y_UNIT_TEST_SUITE(YSetTest) { bool operator()(int lhs, TKey rhs) const { return lhs < rhs.m_data; } - - using is_transparent = void; + + using is_transparent = void; }; struct TKeyCmpPtr { @@ -305,8 +305,8 @@ Y_UNIT_TEST_SUITE(YSetTest) { bool operator()(int lhs, TKey const volatile* rhs) const { return lhs < (*rhs).m_data; } - - using is_transparent = void; + + using is_transparent = void; }; Y_UNIT_TEST(TestTemplateMethods) { diff --git a/util/generic/typetraits.h b/util/generic/typetraits.h index b8a4db5376..d165bd1a06 100644 --- a/util/generic/typetraits.h +++ b/util/generic/typetraits.h @@ -111,7 +111,7 @@ class TTypeTraits: public TTypeTraitsBase<T> { std::false_type, ::NPrivate::TIsSmall<T>>::value); -public: +public: /* * can be used in function templates for effective parameters passing */ diff --git a/util/generic/typetraits_ut.cpp b/util/generic/typetraits_ut.cpp index ad566702f2..e7571c75ec 100644 --- a/util/generic/typetraits_ut.cpp +++ b/util/generic/typetraits_ut.cpp @@ -85,15 +85,15 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTest) { } Y_UNIT_TEST(TestRemoveReference) { - ASSERT_SAME_TYPE(std::remove_reference_t<int>, int); - ASSERT_SAME_TYPE(std::remove_reference_t<const int>, const int); - ASSERT_SAME_TYPE(std::remove_reference_t<int&>, int); - ASSERT_SAME_TYPE(std::remove_reference_t<const int&>, const int); - ASSERT_SAME_TYPE(std::remove_reference_t<int&&>, int); - ASSERT_SAME_TYPE(std::remove_reference_t<const int&&>, const int); + ASSERT_SAME_TYPE(std::remove_reference_t<int>, int); + ASSERT_SAME_TYPE(std::remove_reference_t<const int>, const int); + ASSERT_SAME_TYPE(std::remove_reference_t<int&>, int); + ASSERT_SAME_TYPE(std::remove_reference_t<const int&>, const int); + ASSERT_SAME_TYPE(std::remove_reference_t<int&&>, int); + ASSERT_SAME_TYPE(std::remove_reference_t<const int&&>, const int); class TIncompleteType; - ASSERT_SAME_TYPE(std::remove_reference_t<TIncompleteType&>, TIncompleteType); + ASSERT_SAME_TYPE(std::remove_reference_t<TIncompleteType&>, TIncompleteType); } Y_UNIT_TEST(TestRemoveConst) { @@ -114,22 +114,22 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTest) { Y_UNIT_TEST(TestClass) { UNIT_ASSERT(std::is_class<TString>::value); - UNIT_ASSERT(!std::is_class<ETestEnum>::value); - UNIT_ASSERT(!std::is_class<int>::value); - UNIT_ASSERT(!std::is_class<void*>::value); + UNIT_ASSERT(!std::is_class<ETestEnum>::value); + UNIT_ASSERT(!std::is_class<int>::value); + UNIT_ASSERT(!std::is_class<void*>::value); } template <class T> inline void TestArithmeticType() { - UNIT_ASSERT(std::is_arithmetic<T>::value); - UNIT_ASSERT(std::is_arithmetic<const T>::value); - UNIT_ASSERT(std::is_arithmetic<volatile T>::value); - UNIT_ASSERT(std::is_arithmetic<const volatile T>::value); - - UNIT_ASSERT(!std::is_arithmetic<T&>::value); - UNIT_ASSERT(!std::is_arithmetic<T&&>::value); - UNIT_ASSERT(!std::is_arithmetic<T*>::value); - + UNIT_ASSERT(std::is_arithmetic<T>::value); + UNIT_ASSERT(std::is_arithmetic<const T>::value); + UNIT_ASSERT(std::is_arithmetic<volatile T>::value); + UNIT_ASSERT(std::is_arithmetic<const volatile T>::value); + + UNIT_ASSERT(!std::is_arithmetic<T&>::value); + UNIT_ASSERT(!std::is_arithmetic<T&&>::value); + UNIT_ASSERT(!std::is_arithmetic<T*>::value); + bool a; a = std::is_same<typename TTypeTraits<T>::TFuncParam, T>::value; @@ -138,56 +138,56 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTest) { UNIT_ASSERT(a); } - template <class T> - inline void TestUnsignedIntType() { - UNIT_ASSERT(std::is_unsigned<T>::value); - UNIT_ASSERT(std::is_unsigned<const T>::value); - UNIT_ASSERT(std::is_unsigned<volatile T>::value); - UNIT_ASSERT(std::is_unsigned<const volatile T>::value); - - UNIT_ASSERT(!std::is_unsigned<T&>::value); - UNIT_ASSERT(!std::is_unsigned<T&&>::value); - UNIT_ASSERT(!std::is_unsigned<T*>::value); - + template <class T> + inline void TestUnsignedIntType() { + UNIT_ASSERT(std::is_unsigned<T>::value); + UNIT_ASSERT(std::is_unsigned<const T>::value); + UNIT_ASSERT(std::is_unsigned<volatile T>::value); + UNIT_ASSERT(std::is_unsigned<const volatile T>::value); + + UNIT_ASSERT(!std::is_unsigned<T&>::value); + UNIT_ASSERT(!std::is_unsigned<T&&>::value); + UNIT_ASSERT(!std::is_unsigned<T*>::value); + enum ETypedEnum: T {}; - UNIT_ASSERT(!std::is_unsigned<ETypedEnum>::value); - } - - template <class T> - inline void TestSignedIntType() { - UNIT_ASSERT(std::is_signed<T>::value); - UNIT_ASSERT(std::is_signed<const T>::value); - UNIT_ASSERT(std::is_signed<volatile T>::value); - UNIT_ASSERT(std::is_signed<const volatile T>::value); - - UNIT_ASSERT(!std::is_signed<T&>::value); - UNIT_ASSERT(!std::is_signed<T&&>::value); - UNIT_ASSERT(!std::is_signed<T*>::value); - + UNIT_ASSERT(!std::is_unsigned<ETypedEnum>::value); + } + + template <class T> + inline void TestSignedIntType() { + UNIT_ASSERT(std::is_signed<T>::value); + UNIT_ASSERT(std::is_signed<const T>::value); + UNIT_ASSERT(std::is_signed<volatile T>::value); + UNIT_ASSERT(std::is_signed<const volatile T>::value); + + UNIT_ASSERT(!std::is_signed<T&>::value); + UNIT_ASSERT(!std::is_signed<T&&>::value); + UNIT_ASSERT(!std::is_signed<T*>::value); + enum ETypedEnum: T {}; - UNIT_ASSERT(!std::is_signed<ETypedEnum>::value); - } - + UNIT_ASSERT(!std::is_signed<ETypedEnum>::value); + } + Y_UNIT_TEST(TestBool) { - TestArithmeticType<bool>(); - TestUnsignedIntType<bool>(); - } - + TestArithmeticType<bool>(); + TestUnsignedIntType<bool>(); + } + Y_UNIT_TEST(TestUnsignedChar) { TestArithmeticType<unsigned char>(); - TestUnsignedIntType<unsigned char>(); + TestUnsignedIntType<unsigned char>(); } Y_UNIT_TEST(TestSizeT) { TestArithmeticType<size_t>(); - TestUnsignedIntType<size_t>(); + TestUnsignedIntType<size_t>(); } Y_UNIT_TEST(TestInt) { - TestArithmeticType<int>(); - TestSignedIntType<int>(); - } - + TestArithmeticType<int>(); + TestSignedIntType<int>(); + } + Y_UNIT_TEST(TestDouble) { TestArithmeticType<double>(); } @@ -206,25 +206,25 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTest) { } Y_UNIT_TEST(TestIsEmpty) { - UNIT_ASSERT(std::is_empty<TEmptyClass>::value); - UNIT_ASSERT(std::is_empty<TEmptyDerivedClass>::value); - UNIT_ASSERT(std::is_empty<TAnotherEmptyClass>::value); + UNIT_ASSERT(std::is_empty<TEmptyClass>::value); + UNIT_ASSERT(std::is_empty<TEmptyDerivedClass>::value); + UNIT_ASSERT(std::is_empty<TAnotherEmptyClass>::value); #ifdef _MSC_VER UNIT_ASSERT(!std::is_empty<TEmptyMultiDerivedClass>::value); #else - UNIT_ASSERT(std::is_empty<TEmptyMultiDerivedClass>::value); + UNIT_ASSERT(std::is_empty<TEmptyMultiDerivedClass>::value); #endif - UNIT_ASSERT(!std::is_empty<TNonEmptyClass>::value); - UNIT_ASSERT(!std::is_empty<TNonEmptyDerivedClass>::value); + UNIT_ASSERT(!std::is_empty<TNonEmptyClass>::value); + UNIT_ASSERT(!std::is_empty<TNonEmptyDerivedClass>::value); } Y_UNIT_TEST(TestIsStandardLayout) { - UNIT_ASSERT(std::is_standard_layout<TStdLayoutClass1>::value); - UNIT_ASSERT(std::is_standard_layout<TStdLayoutClass2>::value); - UNIT_ASSERT(!std::is_standard_layout<TNonStdLayoutClass1>::value); - UNIT_ASSERT(!std::is_standard_layout<TNonStdLayoutClass2>::value); - UNIT_ASSERT(!std::is_standard_layout<TNonStdLayoutClass3>::value); - UNIT_ASSERT(!std::is_standard_layout<TNonStdLayoutClass4>::value); + UNIT_ASSERT(std::is_standard_layout<TStdLayoutClass1>::value); + UNIT_ASSERT(std::is_standard_layout<TStdLayoutClass2>::value); + UNIT_ASSERT(!std::is_standard_layout<TNonStdLayoutClass1>::value); + UNIT_ASSERT(!std::is_standard_layout<TNonStdLayoutClass2>::value); + UNIT_ASSERT(!std::is_standard_layout<TNonStdLayoutClass3>::value); + UNIT_ASSERT(!std::is_standard_layout<TNonStdLayoutClass4>::value); } template <class T> @@ -385,18 +385,18 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTestNg) { template <typename T> void TestImpl() { //UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsPod, TTypeTraits<T>::IsPod); - UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsVoid, std::is_void<T>::value); - UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsEnum, std::is_enum<T>::value); - UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsIntegral, std::is_integral<T>::value); - UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsArithmetic, std::is_arithmetic<T>::value); - UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsVolatile, std::is_volatile<T>::value); - UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsConstant, std::is_const<T>::value); - UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsPointer, std::is_pointer<T>::value); - UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsReference, std::is_reference<T>::value); - UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsLvalueReference, std::is_lvalue_reference<T>::value); - UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsRvalueReference, std::is_rvalue_reference<T>::value); - UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsArray, std::is_array<T>::value); - UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsClassType, std::is_class<T>::value); + UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsVoid, std::is_void<T>::value); + UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsEnum, std::is_enum<T>::value); + UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsIntegral, std::is_integral<T>::value); + UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsArithmetic, std::is_arithmetic<T>::value); + UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsVolatile, std::is_volatile<T>::value); + UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsConstant, std::is_const<T>::value); + UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsPointer, std::is_pointer<T>::value); + UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsReference, std::is_reference<T>::value); + UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsLvalueReference, std::is_lvalue_reference<T>::value); + UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsRvalueReference, std::is_rvalue_reference<T>::value); + UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsArray, std::is_array<T>::value); + UNIT_ASSERT_EQUAL_ENUM(TTypeTraitsExpected<T>::IsClassType, std::is_class<T>::value); } #define TYPE_TEST(name, type) \ diff --git a/util/generic/xrange.h b/util/generic/xrange.h index 6478b1cd22..5fc8c82912 100644 --- a/util/generic/xrange.h +++ b/util/generic/xrange.h @@ -30,14 +30,14 @@ namespace NPrivate { { } - class TIterator { + class TIterator { public: - using value_type = T; - using difference_type = TDiff; - using pointer = const T*; - using reference = const T&; - using iterator_category = std::random_access_iterator_tag; - + using value_type = T; + using difference_type = TDiff; + using pointer = const T*; + using reference = const T&; + using iterator_category = std::random_access_iterator_tag; + constexpr TIterator(T value) noexcept : Value(value) { @@ -135,17 +135,17 @@ namespace NPrivate { , Step_(step) , Finish_(CalcRealFinish(Start_, finish, Step_)) { - static_assert(std::is_integral<T>::value || std::is_pointer<T>::value, "T should be integral type or pointer"); + static_assert(std::is_integral<T>::value || std::is_pointer<T>::value, "T should be integral type or pointer"); } - class TIterator { + class TIterator { public: - using value_type = T; - using difference_type = TDiff; - using pointer = const T*; - using reference = const T&; - using iterator_category = std::random_access_iterator_tag; - + using value_type = T; + using difference_type = TDiff; + using pointer = const T*; + using reference = const T&; + using iterator_category = std::random_access_iterator_tag; + constexpr TIterator(T value, const TSteppedXRange& parent) noexcept : Value_(value) , Parent_(&parent) diff --git a/util/generic/ymath.h b/util/generic/ymath.h index 0614b1d080..9ff9ae2abe 100644 --- a/util/generic/ymath.h +++ b/util/generic/ymath.h @@ -1,6 +1,6 @@ #pragma once -#include <util/system/yassert.h> +#include <util/system/yassert.h> #include <util/system/defaults.h> #include <cmath> @@ -120,32 +120,32 @@ inline double LogGamma(double x) noexcept { return LogGammaImpl(x); #endif } - -/** - * @returns x^n for integer n, n >= 0. - */ + +/** + * @returns x^n for integer n, n >= 0. + */ template <class T, class Int> -T Power(T x, Int n) { - static_assert(std::is_integral<Int>::value, "only integer powers are supported"); - Y_ASSERT(n >= 0); - if (n == 0) { - return T(1); - } - while ((n & 1) == 0) { - x = x * x; - n >>= 1; - } - T result = x; - n >>= 1; - while (n > 0) { - x = x * x; - if (n & 1) { - result = result * x; - } - n >>= 1; - } - return result; -}; +T Power(T x, Int n) { + static_assert(std::is_integral<Int>::value, "only integer powers are supported"); + Y_ASSERT(n >= 0); + if (n == 0) { + return T(1); + } + while ((n & 1) == 0) { + x = x * x; + n >>= 1; + } + T result = x; + n >>= 1; + while (n > 0) { + x = x * x; + if (n & 1) { + result = result * x; + } + n >>= 1; + } + return result; +}; /** * Compares two floating point values and returns true if they are considered equal. diff --git a/util/generic/ymath_ut.cpp b/util/generic/ymath_ut.cpp index 218801d1e6..29190b55eb 100644 --- a/util/generic/ymath_ut.cpp +++ b/util/generic/ymath_ut.cpp @@ -32,7 +32,7 @@ class TMathTest: public TTestBase { UNIT_TEST(TestLogGamma); UNIT_TEST(TestIsValidFloat); UNIT_TEST(TestAbs); - UNIT_TEST(TestPower); + UNIT_TEST(TestPower); UNIT_TEST(TestSigmoid); UNIT_TEST(TestCeilDiv); UNIT_TEST_SUITE_END(); @@ -43,7 +43,7 @@ private: void TestErf(); void TestLogGamma(); void TestAbs(); - void TestPower(); + void TestPower(); void TestSigmoid(); void TestCeilDiv(); @@ -172,15 +172,15 @@ void TMathTest::TestAbs() { UNIT_ASSERT_VALUES_EQUAL(Abs(-1.0), 1.0); UNIT_ASSERT_VALUES_EQUAL(Abs(0.0), 0.0); } - -void TMathTest::TestPower() { - UNIT_ASSERT_VALUES_EQUAL(Power(0, 0), 1); - UNIT_ASSERT_VALUES_EQUAL(Power(-1, 1), -1); - UNIT_ASSERT_VALUES_EQUAL(Power(-1, 2), 1); - UNIT_ASSERT_VALUES_EQUAL(Power(2LL, 32), 1LL << 32); - UNIT_ASSERT_DOUBLES_EQUAL(Power(0.0, 0), 1.0, 1e-9); - UNIT_ASSERT_DOUBLES_EQUAL(Power(0.1, 3), 1e-3, 1e-9); -} + +void TMathTest::TestPower() { + UNIT_ASSERT_VALUES_EQUAL(Power(0, 0), 1); + UNIT_ASSERT_VALUES_EQUAL(Power(-1, 1), -1); + UNIT_ASSERT_VALUES_EQUAL(Power(-1, 2), 1); + UNIT_ASSERT_VALUES_EQUAL(Power(2LL, 32), 1LL << 32); + UNIT_ASSERT_DOUBLES_EQUAL(Power(0.0, 0), 1.0, 1e-9); + UNIT_ASSERT_DOUBLES_EQUAL(Power(0.1, 3), 1e-3, 1e-9); +} void TMathTest::TestSigmoid() { UNIT_ASSERT_EQUAL(Sigmoid(0.f), 0.5f); diff --git a/util/memory/alloc.h b/util/memory/alloc.h index 36367a7eef..d59575aef5 100644 --- a/util/memory/alloc.h +++ b/util/memory/alloc.h @@ -3,7 +3,7 @@ #include <memory> template <class Allocator, class T> -using TReboundAllocator = typename std::allocator_traits<Allocator>::template rebind_alloc<T>; +using TReboundAllocator = typename std::allocator_traits<Allocator>::template rebind_alloc<T>; class IAllocator { public: diff --git a/util/memory/pool.h b/util/memory/pool.h index 626bee0ddd..13c8b6b9ed 100644 --- a/util/memory/pool.h +++ b/util/memory/pool.h @@ -212,7 +212,7 @@ public: template <typename TChar> inline TChar* Append(const TChar* str, size_t len) { - TChar* ret = AllocateArray<TChar>(len); + TChar* ret = AllocateArray<TChar>(len); std::char_traits<TChar>::copy(ret, str, len); return ret; @@ -417,8 +417,8 @@ private: template <class T> using TPoolAlloc = TPoolAllocBase<T, TMemoryPool>; -// Any type since it is supposed to be rebound anyway. -using TPoolAllocator = TPoolAlloc<int>; +// Any type since it is supposed to be rebound anyway. +using TPoolAllocator = TPoolAlloc<int>; template <class T> inline bool operator==(const TPoolAlloc<T>&, const TPoolAlloc<T>&) noexcept { diff --git a/util/memory/segpool_alloc.h b/util/memory/segpool_alloc.h index fa3ea7d90d..1a83b7a543 100644 --- a/util/memory/segpool_alloc.h +++ b/util/memory/segpool_alloc.h @@ -114,5 +114,5 @@ inline bool operator!=(const segpool_alloc<_Tp>& a1, const segpool_alloc<_Tp>& a return a1.pool != a2.pool; } -// Any type since it is supposed to be rebound anyway. -using segpool_alloc_vt = segpool_alloc<int>; +// Any type since it is supposed to be rebound anyway. +using segpool_alloc_vt = segpool_alloc<int>; diff --git a/util/memory/smallobj.h b/util/memory/smallobj.h index cb0490ab31..63de666bae 100644 --- a/util/memory/smallobj.h +++ b/util/memory/smallobj.h @@ -107,17 +107,17 @@ private: template <class T> class TObjectFromPool { public: - struct THeader { - void* Pool; - // Can't just use T because THeader must be standard layout type for offsetof to work. - alignas(T) char Obj[sizeof(T)]; - }; - using TPool = TSmallObjAllocator<THeader>; + struct THeader { + void* Pool; + // Can't just use T because THeader must be standard layout type for offsetof to work. + alignas(T) char Obj[sizeof(T)]; + }; + using TPool = TSmallObjAllocator<THeader>; inline void* operator new(size_t, TPool* pool) { - THeader* ret = pool->Allocate(); - ret->Pool = pool; - return &ret->Obj; + THeader* ret = pool->Allocate(); + ret->Pool = pool; + return &ret->Obj; } inline void operator delete(void* ptr, size_t) noexcept { @@ -134,8 +134,8 @@ public: private: static inline void DoDelete(void* ptr) noexcept { - static_assert(std::is_standard_layout<THeader>::value, "offsetof is only defined for standard layout types"); - THeader* header = (THeader*)((char*)ptr - offsetof(THeader, Obj)); - ((TPool*)header->Pool)->Release(header); + static_assert(std::is_standard_layout<THeader>::value, "offsetof is only defined for standard layout types"); + THeader* header = (THeader*)((char*)ptr - offsetof(THeader, Obj)); + ((TPool*)header->Pool)->Release(header); } }; diff --git a/util/str_stl.h b/util/str_stl.h index c55239ab15..f1e137181d 100644 --- a/util/str_stl.h +++ b/util/str_stl.h @@ -26,7 +26,7 @@ namespace std { bool operator()(const char* x, const TStringBuf y) const { return strlen(x) == y.size() && memcmp(x, y.data(), y.size()) == 0; } - using is_transparent = void; + using is_transparent = void; }; } @@ -58,7 +58,7 @@ namespace NHashPrivate { } template <class T> -struct hash: public NHashPrivate::THashHelper<T, std::is_scalar<T>::value && !std::is_integral<T>::value> { +struct hash: public NHashPrivate::THashHelper<T, std::is_scalar<T>::value && !std::is_integral<T>::value> { }; template <typename T> @@ -146,7 +146,7 @@ struct THash: public ::hash<T> { }; namespace NHashPrivate { - template <class TFirst, class TSecond, bool IsEmpty = std::is_empty<THash<TFirst>>::value&& std::is_empty<THash<TSecond>>::value> + template <class TFirst, class TSecond, bool IsEmpty = std::is_empty<THash<TFirst>>::value&& std::is_empty<THash<TSecond>>::value> struct TPairHash { private: THash<TFirst> FirstHash; @@ -186,12 +186,12 @@ struct TEqualTo: public std::equal_to<T> { template <> struct TEqualTo<TString>: public TEqualTo<TStringBuf> { - using is_transparent = void; + using is_transparent = void; }; template <> struct TEqualTo<TUtf16String>: public TEqualTo<TWtringBuf> { - using is_transparent = void; + using is_transparent = void; }; template <> @@ -214,7 +214,7 @@ struct TCIEqualTo { template <> struct TCIEqualTo<const char*> { - inline bool operator()(const char* a, const char* b) const { + inline bool operator()(const char* a, const char* b) const { return stricmp(a, b) == 0; } }; @@ -239,12 +239,12 @@ struct TLess: public std::less<T> { template <> struct TLess<TString>: public TLess<TStringBuf> { - using is_transparent = void; + using is_transparent = void; }; template <> struct TLess<TUtf16String>: public TLess<TWtringBuf> { - using is_transparent = void; + using is_transparent = void; }; template <> @@ -258,12 +258,12 @@ struct TGreater: public std::greater<T> { template <> struct TGreater<TString>: public TGreater<TStringBuf> { - using is_transparent = void; + using is_transparent = void; }; template <> struct TGreater<TUtf16String>: public TGreater<TWtringBuf> { - using is_transparent = void; + using is_transparent = void; }; template <> diff --git a/util/stream/format.h b/util/stream/format.h index fb0c2103b7..b033208a1b 100644 --- a/util/stream/format.h +++ b/util/stream/format.h @@ -104,7 +104,7 @@ namespace NFormatPrivate { }; template <typename T, size_t Base> - using TUnsignedBaseNumber = TBaseNumber<std::make_unsigned_t<std::remove_cv_t<T>>, Base>; + using TUnsignedBaseNumber = TBaseNumber<std::make_unsigned_t<std::remove_cv_t<T>>, Base>; template <typename T, size_t Base> IOutputStream& operator<<(IOutputStream& stream, const TBaseNumber<T, Base>& value) { @@ -155,8 +155,8 @@ namespace NFormatPrivate { template <typename T> struct TFloatPrecision { - using TdVal = std::remove_cv_t<T>; - static_assert(std::is_floating_point<TdVal>::value, "expect std::is_floating_point<TdVal>::value"); + using TdVal = std::remove_cv_t<T>; + static_assert(std::is_floating_point<TdVal>::value, "expect std::is_floating_point<TdVal>::value"); TdVal Value; EFloatToStringMode Mode; diff --git a/util/stream/zlib.cpp b/util/stream/zlib.cpp index 5e9659b197..60f4e9439f 100644 --- a/util/stream/zlib.cpp +++ b/util/stream/zlib.cpp @@ -208,13 +208,13 @@ public: ythrow TZLibCompressorError() << "can not init inflate engine"; } - // Create exactly the same files on all platforms by fixing OS field in the header. - if (p.Type == ZLib::GZip) { + // Create exactly the same files on all platforms by fixing OS field in the header. + if (p.Type == ZLib::GZip) { GZHeader_ = MakeHolder<gz_header>(); - GZHeader_->os = 3; // UNIX - deflateSetHeader(Z(), GZHeader_.Get()); - } - + GZHeader_->os = 3; // UNIX + deflateSetHeader(Z(), GZHeader_.Get()); + } + if (p.Dict.size()) { if (deflateSetDictionary(Z(), (const Bytef*)p.Dict.data(), p.Dict.size())) { ythrow TZLibCompressorError() << "can not set deflate dictionary"; @@ -315,7 +315,7 @@ private: private: IOutputStream* Stream_; - THolder<gz_header> GZHeader_; + THolder<gz_header> GZHeader_; }; TZLibDecompress::TZLibDecompress(IZeroCopyInput* input, ZLib::StreamType type, TStringBuf dict) diff --git a/util/string/cast.cpp b/util/string/cast.cpp index a69eba290d..aa1e65a8e9 100644 --- a/util/string/cast.cpp +++ b/util/string/cast.cpp @@ -69,7 +69,7 @@ namespace { template <class T, unsigned base, class TChar> struct TBasicIntFormatter { static_assert(1 < base && base < 17, "expect 1 < base && base < 17"); - static_assert(std::is_unsigned<T>::value, "TBasicIntFormatter can only handle unsigned integers."); + static_assert(std::is_unsigned<T>::value, "TBasicIntFormatter can only handle unsigned integers."); static inline size_t Format(T value, TChar* buf, size_t len) { Y_ENSURE(len, TStringBuf("zero length")); @@ -105,7 +105,7 @@ namespace { template <class T, unsigned base, class TChar> struct TIntFormatter { static_assert(1 < base && base < 17, "expect 1 < base && base < 17"); - static_assert(std::is_integral<T>::value, "T must be an integral type."); + static_assert(std::is_integral<T>::value, "T must be an integral type."); static inline size_t Format(T value, TChar* buf, size_t len) { using TUFmt = TBasicIntFormatter<std::make_unsigned_t<T>, base, TChar>; @@ -180,7 +180,7 @@ namespace { template <class T, unsigned base, class TChar> struct TBasicIntParser { static_assert(1 < base && base < 17, "Expect 1 < base && base < 17."); - static_assert(std::is_unsigned<T>::value, "TBasicIntParser can only handle unsigned integers."); + static_assert(std::is_unsigned<T>::value, "TBasicIntParser can only handle unsigned integers."); enum : unsigned { BASE_POW_2 = base * base, @@ -270,10 +270,10 @@ namespace { template <class T, unsigned base, class TChar> struct TIntParser { static_assert(1 < base && base < 17, "Expect 1 < base && base < 17."); - static_assert(std::is_integral<T>::value, "T must be an integral type."); + static_assert(std::is_integral<T>::value, "T must be an integral type."); enum { - IsSigned = std::is_signed<T>::value + IsSigned = std::is_signed<T>::value }; using TUnsigned = std::make_unsigned_t<T>; diff --git a/util/string/cast.h b/util/string/cast.h index 6cf7e1f1c5..90e925c194 100644 --- a/util/string/cast.h +++ b/util/string/cast.h @@ -82,9 +82,9 @@ namespace NPrivate { */ template <class T> inline TString ToString(const T& t) { - using TR = std::remove_cv_t<T>; + using TR = std::remove_cv_t<T>; - return ::NPrivate::TToString<TR, std::is_arithmetic<TR>::value>::Cvt((const TR&)t); + return ::NPrivate::TToString<TR, std::is_arithmetic<TR>::value>::Cvt((const TR&)t); } inline const TString& ToString(const TString& s) noexcept { @@ -273,8 +273,8 @@ inline bool TryFromString(const TUtf16String& s, T& result) { template <class T, class TStringType> inline bool TryFromStringWithDefault(const TStringType& s, T& result, const T& def) { return TryFromString<T>(s.data(), s.size(), result, def); -} - +} + template <class T> inline bool TryFromStringWithDefault(const char* s, T& result, const T& def) { return TryFromStringWithDefault<T>(TStringBuf(s), result, def); @@ -296,8 +296,8 @@ inline T FromString(const TChar* data, const size_t len, const T& def) { template <class T, class TStringType> inline T FromStringWithDefault(const TStringType& s, const T& def) { return FromString<T>(s.data(), s.size(), def); -} - +} + template <class T> inline T FromStringWithDefault(const char* s, const T& def) { return FromStringWithDefault<T>(TStringBuf(s), def); @@ -316,7 +316,7 @@ size_t IntToString(T t, char* buf, size_t len); template <int base, class T> inline TString IntToString(T t) { - static_assert(std::is_arithmetic<std::remove_cv_t<T>>::value, "expect std::is_arithmetic<std::remove_cv_t<T>>::value"); + static_assert(std::is_arithmetic<std::remove_cv_t<T>>::value, "expect std::is_arithmetic<std::remove_cv_t<T>>::value"); char buf[256]; diff --git a/util/system/atomic_ops.h b/util/system/atomic_ops.h index a29773df2a..76766b4a0a 100644 --- a/util/system/atomic_ops.h +++ b/util/system/atomic_ops.h @@ -17,7 +17,7 @@ inline const TAtomic* AsAtomicPtr(T const volatile* target) { template <typename T> struct TAtomicTraits { enum { - Castable = std::is_integral<T>::value && sizeof(T) == sizeof(TAtomicBase) && !std::is_const<T>::value, + Castable = std::is_integral<T>::value && sizeof(T) == sizeof(TAtomicBase) && !std::is_const<T>::value, }; }; diff --git a/util/system/compiler.h b/util/system/compiler.h index 0da7e3e817..b373edcc46 100644 --- a/util/system/compiler.h +++ b/util/system/compiler.h @@ -274,8 +274,8 @@ _YandexAbort(); #define _ubsan_enabled_ #endif -#ifdef __clang__ - +#ifdef __clang__ + #if __has_feature(thread_sanitizer) #define _tsan_enabled_ #endif @@ -286,7 +286,7 @@ _YandexAbort(); #define _asan_enabled_ #endif -#else +#else #if defined(thread_sanitizer_enabled) || defined(__SANITIZE_THREAD__) #define _tsan_enabled_ @@ -298,8 +298,8 @@ _YandexAbort(); #define _asan_enabled_ #endif -#endif - +#endif + #if defined(_asan_enabled_) || defined(_msan_enabled_) || defined(_tsan_enabled_) || defined(_ubsan_enabled_) #define _san_enabled_ #endif @@ -550,8 +550,8 @@ _YandexAbort(); #define Y_PRAGMA_NO_DEPRECATED #endif -// Memory sanitizer sometimes doesn't correctly set parameter shadow of constant functions. -#if (defined(__clang__) || defined(__GNUC__)) && !defined(_msan_enabled_) +// Memory sanitizer sometimes doesn't correctly set parameter shadow of constant functions. +#if (defined(__clang__) || defined(__GNUC__)) && !defined(_msan_enabled_) /** * @def Y_CONST_FUNCTION methods and functions, marked with this method are promised to: @@ -601,14 +601,14 @@ _YandexAbort(); #if defined(__SIZEOF_INT128__) #define Y_HAVE_INT128 1 #endif - -/** - * XRAY macro must be passed to compiler if XRay is enabled. - * - * Define everything XRay-specific as a macro so that it doesn't cause errors - * for compilers that doesn't support XRay. - */ -#if defined(XRAY) && defined(__cplusplus) + +/** + * XRAY macro must be passed to compiler if XRay is enabled. + * + * Define everything XRay-specific as a macro so that it doesn't cause errors + * for compilers that doesn't support XRay. + */ +#if defined(XRAY) && defined(__cplusplus) #include <xray/xray_interface.h> #define Y_XRAY_ALWAYS_INSTRUMENT [[clang::xray_always_instrument]] #define Y_XRAY_NEVER_INSTRUMENT [[clang::xray_never_instrument]] @@ -616,13 +616,13 @@ _YandexAbort(); do { \ __xray_customevent(__string, __length); \ } while (0) -#else +#else #define Y_XRAY_ALWAYS_INSTRUMENT #define Y_XRAY_NEVER_INSTRUMENT #define Y_XRAY_CUSTOM_EVENT(__string, __length) \ do { \ } while (0) -#endif +#endif #ifdef __cplusplus diff --git a/util/system/direct_io_ut.cpp b/util/system/direct_io_ut.cpp index 3a4839aa9b..839c3de7ca 100644 --- a/util/system/direct_io_ut.cpp +++ b/util/system/direct_io_ut.cpp @@ -21,7 +21,7 @@ Y_UNIT_TEST_SUITE(TDirectIoTestSuite) { size_t writeCount = Min<size_t>(1 + RandomNumber<size_t>(1 << 10), data.ysize() - writePos); file.Write(&data[writePos], sizeof(ui64) * writeCount); writePos += writeCount; - size_t readPos = RandomNumber(writePos); + size_t readPos = RandomNumber(writePos); size_t readCount = RandomNumber(writePos - readPos); UNIT_ASSERT_VALUES_EQUAL( file.Pread(&readResult[0], readCount * sizeof(ui64), readPos * sizeof(ui64)), @@ -33,7 +33,7 @@ Y_UNIT_TEST_SUITE(TDirectIoTestSuite) { file.Finish(); TDirectIOBufferedFile fileNew(FileName_, RdOnly | Direct | Seq | OpenAlways, 1 << 15); for (int i = 0; i < 1000; ++i) { - size_t readPos = RandomNumber(data.size()); + size_t readPos = RandomNumber(data.size()); size_t readCount = RandomNumber(data.size() - readPos); UNIT_ASSERT_VALUES_EQUAL( fileNew.Pread(&readResult[0], readCount * sizeof(ui64), readPos * sizeof(ui64)), diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp index 2c2ce82436..7454a4cb94 100644 --- a/util/system/filemap.cpp +++ b/util/system/filemap.cpp @@ -106,7 +106,7 @@ static int ModeToMmapProt(TMemoryMapCommon::EOpenMode mode) { void NPrivate::Precharge(const void* data, size_t dataSize, size_t off, size_t size) { if (off > dataSize) { assert(false); - return; + return; } size_t endOff = (size == (size_t)-1 ? dataSize : off + size); if (endOff > dataSize) { @@ -115,12 +115,12 @@ void NPrivate::Precharge(const void* data, size_t dataSize, size_t off, size_t s } size = endOff - off; if (dataSize == 0 || size == 0) { - return; + return; } volatile const char *c = (const char*)data + off, *e = c + size; for (; c < e; c += 512) { - *c; + *c; } } @@ -525,7 +525,7 @@ TFileMap::~TFileMap() { } } -void TFileMap::Precharge(size_t pos, size_t size) const { +void TFileMap::Precharge(size_t pos, size_t size) const { NPrivate::Precharge(Ptr(), MappedSize(), pos, size); } diff --git a/util/system/filemap.h b/util/system/filemap.h index aff66988a5..11be64bff4 100644 --- a/util/system/filemap.h +++ b/util/system/filemap.h @@ -166,7 +166,7 @@ public: return Map_.GetFile(); } - void Precharge(size_t pos = 0, size_t size = (size_t)-1) const; + void Precharge(size_t pos = 0, size_t size = (size_t)-1) const; void SetSequential() { Map_.SetSequential(); diff --git a/util/system/hi_lo.h b/util/system/hi_lo.h index d319133a28..f86870534f 100644 --- a/util/system/hi_lo.h +++ b/util/system/hi_lo.h @@ -2,8 +2,8 @@ #include "unaligned_mem.h" -#include <utility> - +#include <utility> + #ifndef _little_endian_ #error "Not implemented" #endif diff --git a/util/ysaveload.h b/util/ysaveload.h index 630c7646d8..02efb4049b 100644 --- a/util/ysaveload.h +++ b/util/ysaveload.h @@ -21,7 +21,7 @@ public: * pointer types cannot be serialized as POD-type */ enum { - IsSerializablePod = TTypeTraits<T>::IsPod && !std::is_pointer<T>::value + IsSerializablePod = TTypeTraits<T>::IsPod && !std::is_pointer<T>::value }; }; @@ -218,17 +218,17 @@ struct TRangeSerialize<It, false> { template <class It> static inline void SaveRange(IOutputStream* rh, It b, It e) { - TRangeSerialize<It, std::is_pointer<It>::value>::Save(rh, b, e); + TRangeSerialize<It, std::is_pointer<It>::value>::Save(rh, b, e); } template <class It> static inline void LoadRange(IInputStream* rh, It b, It e) { - TRangeSerialize<It, std::is_pointer<It>::value>::Load(rh, b, e); + TRangeSerialize<It, std::is_pointer<It>::value>::Load(rh, b, e); } template <class It, class TStorage> static inline void LoadRange(IInputStream* rh, It b, It e, TStorage& pool) { - TRangeSerialize<It, std::is_pointer<It>::value>::Load(rh, b, e, pool); + TRangeSerialize<It, std::is_pointer<It>::value>::Load(rh, b, e, pool); } template <class T> @@ -383,19 +383,19 @@ class TSerializer<std::deque<T, A>>: public TVectorSerializer<std::deque<T, A>> }; template <class TArray> -class TStdArraySerializer { +class TStdArraySerializer { public: static inline void Save(IOutputStream* rh, const TArray& a) { - ::SaveArray(rh, a.data(), a.size()); + ::SaveArray(rh, a.data(), a.size()); } static inline void Load(IInputStream* rh, TArray& a) { - ::LoadArray(rh, a.data(), a.size()); + ::LoadArray(rh, a.data(), a.size()); } }; template <class T, size_t N> -class TSerializer<std::array<T, N>>: public TStdArraySerializer<std::array<T, N>> { +class TSerializer<std::array<T, N>>: public TStdArraySerializer<std::array<T, N>> { }; template <class A, class B> |