diff options
author | somov <somov@yandex-team.ru> | 2022-02-10 16:45:47 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:47 +0300 |
commit | a5950576e397b1909261050b8c7da16db58f10b1 (patch) | |
tree | 7ba7677f6a4c3e19e2cefab34d16df2c8963b4d4 /contrib/restricted/abseil-cpp-tstring/y_absl/hash | |
parent | 81eddc8c0b55990194e112b02d127b87d54164a9 (diff) | |
download | ydb-a5950576e397b1909261050b8c7da16db58f10b1.tar.gz |
Restoring authorship annotation for <somov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/restricted/abseil-cpp-tstring/y_absl/hash')
7 files changed, 127 insertions, 127 deletions
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/hash/hash.h b/contrib/restricted/abseil-cpp-tstring/y_absl/hash/hash.h index 1e93ee96d9..cea1fa5ba5 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/hash/hash.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/hash/hash.h @@ -19,8 +19,8 @@ // This header file defines the Abseil `hash` library and the Abseil hashing // framework. This framework consists of the following: // -// * The `y_absl::Hash` functor, which is used to invoke the hasher within the -// Abseil hashing framework. `y_absl::Hash<T>` supports most basic types and +// * The `y_absl::Hash` functor, which is used to invoke the hasher within the +// Abseil hashing framework. `y_absl::Hash<T>` supports most basic types and // a number of Abseil types out of the box. // * `AbslHashValue`, an extension point that allows you to extend types to // support Abseil hashing without requiring you to define a hashing @@ -34,7 +34,7 @@ // provides most of its utility by abstracting away the hash algorithm (and its // implementation) entirely. Instead, a type invokes the Abseil hashing // framework by simply combining its state with the state of known, hashable -// types. Hashing of that combined state is separately done by `y_absl::Hash`. +// types. Hashing of that combined state is separately done by `y_absl::Hash`. // // One should assume that a hash algorithm is chosen randomly at the start of // each process. E.g., `y_absl::Hash<int>{}(9)` in one process and @@ -68,23 +68,23 @@ // ... // }; // -// For more information, see Adding Type Support to `y_absl::Hash` below. +// For more information, see Adding Type Support to `y_absl::Hash` below. // #ifndef ABSL_HASH_HASH_H_ #define ABSL_HASH_HASH_H_ #include <tuple> -#include "y_absl/hash/internal/hash.h" +#include "y_absl/hash/internal/hash.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN // ----------------------------------------------------------------------------- -// `y_absl::Hash` +// `y_absl::Hash` // ----------------------------------------------------------------------------- // -// `y_absl::Hash<T>` is a convenient general-purpose hash functor for any type `T` +// `y_absl::Hash<T>` is a convenient general-purpose hash functor for any type `T` // satisfying any of the following conditions (in order): // // * T is an arithmetic or pointer type @@ -92,7 +92,7 @@ ABSL_NAMESPACE_BEGIN // hash state `H`. // - T defines a specialization of `std::hash<T>` // -// `y_absl::Hash` intrinsically supports the following types: +// `y_absl::Hash` intrinsically supports the following types: // // * All integral types (including bool) // * All enum types @@ -103,32 +103,32 @@ ABSL_NAMESPACE_BEGIN // * std::unique_ptr and std::shared_ptr // * All string-like types including: // * y_absl::Cord -// * TString +// * TString // * std::string_view (as well as any instance of std::basic_string that // uses char and std::char_traits) // * All the standard sequence containers (provided the elements are hashable) // * All the standard ordered associative containers (provided the elements are // hashable) -// * y_absl types such as the following: -// * y_absl::string_view -// * y_absl::InlinedVector -// * y_absl::FixedArray -// * y_absl::uint128 -// * y_absl::Time, y_absl::Duration, and y_absl::TimeZone +// * y_absl types such as the following: +// * y_absl::string_view +// * y_absl::InlinedVector +// * y_absl::FixedArray +// * y_absl::uint128 +// * y_absl::Time, y_absl::Duration, and y_absl::TimeZone // // Note: the list above is not meant to be exhaustive. Additional type support // may be added, in which case the above list will be updated. // // ----------------------------------------------------------------------------- -// y_absl::Hash Invocation Evaluation +// y_absl::Hash Invocation Evaluation // ----------------------------------------------------------------------------- // -// When invoked, `y_absl::Hash<T>` searches for supplied hash functions in the +// When invoked, `y_absl::Hash<T>` searches for supplied hash functions in the // following order: // // * Natively supported types out of the box (see above) // * Types for which an `AbslHashValue()` overload is provided (such as -// user-defined types). See "Adding Type Support to `y_absl::Hash`" below. +// user-defined types). See "Adding Type Support to `y_absl::Hash`" below. // * Types which define a `std::hash<T>` specialization // // The fallback to legacy hash functions exists mainly for backwards @@ -139,17 +139,17 @@ ABSL_NAMESPACE_BEGIN // The Hash State Concept, and using `HashState` for Type Erasure // ----------------------------------------------------------------------------- // -// The `y_absl::Hash` framework relies on the Concept of a "hash state." Such a +// The `y_absl::Hash` framework relies on the Concept of a "hash state." Such a // hash state is used in several places: // -// * Within existing implementations of `y_absl::Hash<T>` to store the hashed +// * Within existing implementations of `y_absl::Hash<T>` to store the hashed // state of an object. Note that it is up to the implementation how it stores // such state. A hash table, for example, may mix the state to produce an // integer value; a testing framework may simply hold a vector of that state. // * Within implementations of `AbslHashValue()` used to extend user-defined -// types. (See "Adding Type Support to y_absl::Hash" below.) +// types. (See "Adding Type Support to y_absl::Hash" below.) // * Inside a `HashState`, providing type erasure for the concept of a hash -// state, which you can use to extend the `y_absl::Hash` framework for types +// state, which you can use to extend the `y_absl::Hash` framework for types // that are otherwise difficult to extend using `AbslHashValue()`. (See the // `HashState` class below.) // @@ -188,7 +188,7 @@ ABSL_NAMESPACE_BEGIN // loop instead. // // ----------------------------------------------------------------------------- -// Adding Type Support to `y_absl::Hash` +// Adding Type Support to `y_absl::Hash` // ----------------------------------------------------------------------------- // // To add support for your user-defined type, add a proper `AbslHashValue()` @@ -210,11 +210,11 @@ ABSL_NAMESPACE_BEGIN // file and namespace as said type. The proper `AbslHashValue` implementation // for a given type will be discovered via ADL. // -// Note: unlike `std::hash', `y_absl::Hash` should never be specialized. It must +// Note: unlike `std::hash', `y_absl::Hash` should never be specialized. It must // only be extended by adding `AbslHashValue()` overloads. // template <typename T> -using Hash = y_absl::hash_internal::Hash<T>; +using Hash = y_absl::hash_internal::Hash<T>; // HashOf // @@ -250,7 +250,7 @@ size_t HashOf(const Types&... values) { // provided by the wrapped class. // // Users of this class should still define a template `AbslHashValue` function, -// but can use `y_absl::HashState::Create(&state)` to erase the type of the hash +// but can use `y_absl::HashState::Create(&state)` to erase the type of the hash // state and dispatch to their private hashing logic. // // This state can be used like any other hash state. In particular, you can call @@ -263,20 +263,20 @@ size_t HashOf(const Types&... values) { // template <typename H> // friend H AbslHashValue(H state, const Interface& value) { // state = H::combine(std::move(state), std::type_index(typeid(*this))); -// value.HashValue(y_absl::HashState::Create(&state)); +// value.HashValue(y_absl::HashState::Create(&state)); // return state; // } // private: -// virtual void HashValue(y_absl::HashState state) const = 0; +// virtual void HashValue(y_absl::HashState state) const = 0; // }; // // class Impl : Interface { // private: -// void HashValue(y_absl::HashState state) const override { -// y_absl::HashState::combine(std::move(state), v1_, v2_); +// void HashValue(y_absl::HashState state) const override { +// y_absl::HashState::combine(std::move(state), v1_, v2_); // } // int v1_; -// TString v2_; +// TString v2_; // }; class HashState : public hash_internal::HashStateBase<HashState> { public: @@ -342,6 +342,6 @@ class HashState : public hash_internal::HashStateBase<HashState> { }; ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_HASH_HASH_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/hash/hash_testing.h b/contrib/restricted/abseil-cpp-tstring/y_absl/hash/hash_testing.h index 2f22d37039..d32e21ccd6 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/hash/hash_testing.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/hash/hash_testing.h @@ -22,15 +22,15 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" -#include "y_absl/hash/internal/spy_hash_state.h" -#include "y_absl/meta/type_traits.h" -#include "y_absl/strings/str_cat.h" -#include "y_absl/types/variant.h" +#include "y_absl/hash/internal/spy_hash_state.h" +#include "y_absl/meta/type_traits.h" +#include "y_absl/strings/str_cat.h" +#include "y_absl/types/variant.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN -// Run the y_absl::Hash algorithm over all the elements passed in and verify that +// Run the y_absl::Hash algorithm over all the elements passed in and verify that // their hash expansion is congruent with their `==` operator. // // It is used in conjunction with EXPECT_TRUE. Failures will output information @@ -39,17 +39,17 @@ ABSL_NAMESPACE_BEGIN // Users should pass a collection of types as either an initializer list or a // container of cases. // -// EXPECT_TRUE(y_absl::VerifyTypeImplementsAbslHashCorrectly( +// EXPECT_TRUE(y_absl::VerifyTypeImplementsAbslHashCorrectly( // {v1, v2, ..., vN})); // // std::vector<MyType> cases; // // Fill cases... -// EXPECT_TRUE(y_absl::VerifyTypeImplementsAbslHashCorrectly(cases)); +// EXPECT_TRUE(y_absl::VerifyTypeImplementsAbslHashCorrectly(cases)); // // Users can pass a variety of types for testing heterogeneous lookup with // `std::make_tuple`: // -// EXPECT_TRUE(y_absl::VerifyTypeImplementsAbslHashCorrectly( +// EXPECT_TRUE(y_absl::VerifyTypeImplementsAbslHashCorrectly( // std::make_tuple(v1, v2, ..., vN))); // // @@ -63,7 +63,7 @@ ABSL_NAMESPACE_BEGIN // // Usage: // -// EXPECT_TRUE(y_absl::VerifyTypeImplementsAbslHashCorrectly( +// EXPECT_TRUE(y_absl::VerifyTypeImplementsAbslHashCorrectly( // std::make_tuple(v1, v2, ..., vN), MyCustomEq{})); // // It checks the following requirements: @@ -128,7 +128,7 @@ ABSL_NAMESPACE_BEGIN // } // friend bool operator==(Bad4 x, Bad4 y) { // // Compare two ranges for equality. C++14 code can instead use std::equal. -// return y_absl::equal(x.p, x.p + x.size, y.p, y.p + y.size); +// return y_absl::equal(x.p, x.p + x.size, y.p, y.p + y.size); // } // }; // @@ -162,8 +162,8 @@ namespace hash_internal { struct PrintVisitor { size_t index; template <typename T> - TString operator()(const T* value) const { - return y_absl::StrCat("#", index, "(", testing::PrintToString(*value), ")"); + TString operator()(const T* value) const { + return y_absl::StrCat("#", index, "(", testing::PrintToString(*value), ")"); } }; @@ -191,10 +191,10 @@ VerifyTypeImplementsAbslHashCorrectly(const Container& values, Eq equals) { struct Info { const V& value; size_t index; - TString ToString() const { - return y_absl::visit(PrintVisitor{index}, value); + TString ToString() const { + return y_absl::visit(PrintVisitor{index}, value); } - SpyHashState expand() const { return y_absl::visit(ExpandVisitor{}, value); } + SpyHashState expand() const { return y_absl::visit(ExpandVisitor{}, value); } }; using EqClass = std::vector<Info>; @@ -205,7 +205,7 @@ VerifyTypeImplementsAbslHashCorrectly(const Container& values, Eq equals) { for (const auto& value : values) { EqClass* c = nullptr; for (auto& eqclass : classes) { - if (y_absl::visit(EqVisitor<Eq>{equals}, value, eqclass[0].value)) { + if (y_absl::visit(EqVisitor<Eq>{equals}, value, eqclass[0].value)) { c = &eqclass; break; } @@ -297,11 +297,11 @@ struct MakeTypeSet<T, Ts...> : MakeTypeSet<Ts...>::template Insert<T>::type {}; template <typename... T> using VariantForTypes = typename MakeTypeSet< - const typename std::decay<T>::type*...>::template apply<y_absl::variant>; + const typename std::decay<T>::type*...>::template apply<y_absl::variant>; template <typename Container> struct ContainerAsVector { - using V = y_absl::variant<const typename Container::value_type*>; + using V = y_absl::variant<const typename Container::value_type*>; using Out = std::vector<V>; static Out Do(const Container& values) { @@ -317,12 +317,12 @@ struct ContainerAsVector<std::tuple<T...>> { using Out = std::vector<V>; template <size_t... I> - static Out DoImpl(const std::tuple<T...>& tuple, y_absl::index_sequence<I...>) { + static Out DoImpl(const std::tuple<T...>& tuple, y_absl::index_sequence<I...>) { return Out{&std::get<I>(tuple)...}; } static Out Do(const std::tuple<T...>& values) { - return DoImpl(values, y_absl::index_sequence_for<T...>()); + return DoImpl(values, y_absl::index_sequence_for<T...>()); } }; @@ -373,6 +373,6 @@ VerifyTypeImplementsAbslHashCorrectly(std::initializer_list<T> values, } ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_HASH_HASH_TESTING_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/city.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/city.cc index 5f1b655e7e..9416ed5c86 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/city.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/city.cc @@ -19,23 +19,23 @@ // possible hash functions, by using SIMD instructions, or by // compromising on hash quality. -#include "y_absl/hash/internal/city.h" +#include "y_absl/hash/internal/city.h" #include <string.h> // for memcpy and memset #include <algorithm> -#include "y_absl/base/config.h" -#include "y_absl/base/internal/endian.h" -#include "y_absl/base/internal/unaligned_access.h" -#include "y_absl/base/optimization.h" +#include "y_absl/base/config.h" +#include "y_absl/base/internal/endian.h" +#include "y_absl/base/internal/unaligned_access.h" +#include "y_absl/base/optimization.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace hash_internal { #ifdef ABSL_IS_BIG_ENDIAN -#define uint32_in_expected_order(x) (y_absl::gbswap_32(x)) -#define uint64_in_expected_order(x) (y_absl::gbswap_64(x)) +#define uint32_in_expected_order(x) (y_absl::gbswap_32(x)) +#define uint64_in_expected_order(x) (y_absl::gbswap_64(x)) #else #define uint32_in_expected_order(x) (x) #define uint64_in_expected_order(x) (x) @@ -171,9 +171,9 @@ uint32_t CityHash32(const char *s, size_t len) { h = Rotate32(h, 19); h = h * 5 + 0xe6546b64; g ^= b4; - g = y_absl::gbswap_32(g) * 5; + g = y_absl::gbswap_32(g) * 5; h += b4 * 5; - h = y_absl::gbswap_32(h); + h = y_absl::gbswap_32(h); f += b0; PERMUTE3(f, h, g); s += 20; @@ -286,11 +286,11 @@ static uint64_t HashLen33to64(const char *s, size_t len) { uint64_t h = Fetch64(s + len - 16) * mul; uint64_t u = Rotate(a + g, 43) + (Rotate(b, 30) + c) * 9; uint64_t v = ((a + g) ^ d) + f + 1; - uint64_t w = y_absl::gbswap_64((u + v) * mul) + h; + uint64_t w = y_absl::gbswap_64((u + v) * mul) + h; uint64_t x = Rotate(e + f, 42) + c; - uint64_t y = (y_absl::gbswap_64((v + w) * mul) + g) * mul; + uint64_t y = (y_absl::gbswap_64((v + w) * mul) + g) * mul; uint64_t z = e + f + c; - a = y_absl::gbswap_64((x + z) * mul + y) + b; + a = y_absl::gbswap_64((x + z) * mul + y) + b; b = ShiftMix((z + a) * mul + d + h) * mul; return b + x; } @@ -346,4 +346,4 @@ uint64_t CityHash64WithSeeds(const char *s, size_t len, uint64_t seed0, } // namespace hash_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/city.h b/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/city.h index d2b32f0068..c506887906 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/city.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/city.h @@ -52,7 +52,7 @@ #include "y_absl/base/config.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace hash_internal { @@ -73,6 +73,6 @@ uint32_t CityHash32(const char *s, size_t len); } // namespace hash_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_HASH_INTERNAL_CITY_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/hash.cc b/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/hash.cc index fe075de43a..f3feb09171 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/hash.cc +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/hash.cc @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "y_absl/hash/internal/hash.h" +#include "y_absl/hash/internal/hash.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace hash_internal { @@ -66,4 +66,4 @@ uint64_t MixingHashState::LowLevelHashImpl(const unsigned char* data, } // namespace hash_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/hash.h b/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/hash.h index fcbe43accd..531ea87573 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/hash.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/hash.h @@ -41,18 +41,18 @@ #include "y_absl/base/config.h" #include "y_absl/base/internal/unaligned_access.h" -#include "y_absl/base/port.h" -#include "y_absl/container/fixed_array.h" +#include "y_absl/base/port.h" +#include "y_absl/container/fixed_array.h" #include "y_absl/hash/internal/city.h" #include "y_absl/hash/internal/low_level_hash.h" -#include "y_absl/meta/type_traits.h" -#include "y_absl/numeric/int128.h" -#include "y_absl/strings/string_view.h" -#include "y_absl/types/optional.h" -#include "y_absl/types/variant.h" -#include "y_absl/utility/utility.h" - -namespace y_absl { +#include "y_absl/meta/type_traits.h" +#include "y_absl/numeric/int128.h" +#include "y_absl/strings/string_view.h" +#include "y_absl/types/optional.h" +#include "y_absl/types/variant.h" +#include "y_absl/utility/utility.h" + +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace hash_internal { @@ -120,7 +120,7 @@ class PiecewiseCombiner { // A hash state object represents an intermediate state in the computation // of an unspecified hash algorithm. `HashStateBase` provides a CRTP style // base class for hash state implementations. Developers adding type support -// for `y_absl::Hash` should not rely on any parts of the state object other than +// for `y_absl::Hash` should not rely on any parts of the state object other than // the following member functions: // // * HashStateBase::combine() @@ -352,7 +352,7 @@ H AbslHashValue(H hash_state, std::nullptr_t) { // is_hashable() // -// Trait class which returns true if T is hashable by the y_absl::Hash framework. +// Trait class which returns true if T is hashable by the y_absl::Hash framework. // Used for the AbslHashValue implementations for composite types below. template <typename T> struct is_hashable; @@ -370,7 +370,7 @@ AbslHashValue(H hash_state, const std::pair<T1, T2>& p) { // Helper function for hashing a tuple. The third argument should // be an index_sequence running from 0 to tuple_size<Tuple> - 1. template <typename H, typename Tuple, size_t... Is> -H hash_tuple(H hash_state, const Tuple& t, y_absl::index_sequence<Is...>) { +H hash_tuple(H hash_state, const Tuple& t, y_absl::index_sequence<Is...>) { return H::combine(std::move(hash_state), std::get<Is>(t)...); } @@ -381,11 +381,11 @@ template <typename H, typename... Ts> // for now. H #else // _MSC_VER -typename std::enable_if<y_absl::conjunction<is_hashable<Ts>...>::value, H>::type +typename std::enable_if<y_absl::conjunction<is_hashable<Ts>...>::value, H>::type #endif // _MSC_VER AbslHashValue(H hash_state, const std::tuple<Ts...>& t) { return hash_internal::hash_tuple(std::move(hash_state), t, - y_absl::make_index_sequence<sizeof...(Ts)>()); + y_absl::make_index_sequence<sizeof...(Ts)>()); } // ----------------------------------------------------------------------------- @@ -414,16 +414,16 @@ H AbslHashValue(H hash_state, const std::shared_ptr<T>& ptr) { // the same character sequence. These types are: // // - `y_absl::Cord` -// - `TString` (and std::basic_string<char, std::char_traits<char>, A> for +// - `TString` (and std::basic_string<char, std::char_traits<char>, A> for // any allocator A) -// - `y_absl::string_view` and `std::string_view` +// - `y_absl::string_view` and `std::string_view` // // For simplicity, we currently support only `char` strings. This support may // be broadened, if necessary, but with some caution - this overload would // misbehave in cases where the traits' `eq()` member isn't equivalent to `==` // on the underlying character type. template <typename H> -H AbslHashValue(H hash_state, y_absl::string_view str) { +H AbslHashValue(H hash_state, y_absl::string_view str) { return H::combine( H::combine_contiguous(std::move(hash_state), str.data(), str.size()), str.size()); @@ -431,7 +431,7 @@ H AbslHashValue(H hash_state, y_absl::string_view str) { // Support std::wstring, std::u16string and std::u32string. template <typename Char, typename Alloc, typename H, - typename = y_absl::enable_if_t<std::is_same<Char, wchar_t>::value || + typename = y_absl::enable_if_t<std::is_same<Char, wchar_t>::value || std::is_same<Char, char16_t>::value || std::is_same<Char, char32_t>::value>> H AbslHashValue( @@ -583,10 +583,10 @@ typename std::enable_if<is_hashable<T>::value, H>::type AbslHashValue( return H::combine(std::move(hash_state), opt.get()); } -// AbslHashValue for hashing y_absl::optional +// AbslHashValue for hashing y_absl::optional template <typename H, typename T> typename std::enable_if<is_hashable<T>::value, H>::type AbslHashValue( - H hash_state, const y_absl::optional<T>& opt) { + H hash_state, const y_absl::optional<T>& opt) { if (opt) hash_state = H::combine(std::move(hash_state), *opt); return H::combine(std::move(hash_state), opt.has_value()); } @@ -601,12 +601,12 @@ struct VariantVisitor { } }; -// AbslHashValue for hashing y_absl::variant +// AbslHashValue for hashing y_absl::variant template <typename H, typename... T> typename std::enable_if<conjunction<is_hashable<T>...>::value, H>::type -AbslHashValue(H hash_state, const y_absl::variant<T...>& v) { +AbslHashValue(H hash_state, const y_absl::variant<T...>& v) { if (!v.valueless_by_exception()) { - hash_state = y_absl::visit(VariantVisitor<H>{std::move(hash_state)}, v); + hash_state = y_absl::visit(VariantVisitor<H>{std::move(hash_state)}, v); } return H::combine(std::move(hash_state), v.index()); } @@ -689,14 +689,14 @@ struct HashSelect { struct UniquelyRepresentedProbe { template <typename H, typename T> static auto Invoke(H state, const T& value) - -> y_absl::enable_if_t<is_uniquely_represented<T>::value, H> { + -> y_absl::enable_if_t<is_uniquely_represented<T>::value, H> { return hash_internal::hash_bytes(std::move(state), value); } }; struct HashValueProbe { template <typename H, typename T> - static auto Invoke(H state, const T& value) -> y_absl::enable_if_t< + static auto Invoke(H state, const T& value) -> y_absl::enable_if_t< std::is_same<H, decltype(AbslHashValue(std::move(state), value))>::value, H> { @@ -707,7 +707,7 @@ struct HashSelect { struct LegacyHashProbe { #if ABSL_HASH_INTERNAL_SUPPORT_LEGACY_HASH_ template <typename H, typename T> - static auto Invoke(H state, const T& value) -> y_absl::enable_if_t< + static auto Invoke(H state, const T& value) -> y_absl::enable_if_t< std::is_convertible< decltype(ABSL_INTERNAL_LEGACY_HASH_NAMESPACE::hash<T>()(value)), size_t>::value, @@ -722,7 +722,7 @@ struct HashSelect { struct StdHashProbe { template <typename H, typename T> static auto Invoke(H state, const T& value) - -> y_absl::enable_if_t<type_traits_internal::IsHashable<T>::value, H> { + -> y_absl::enable_if_t<type_traits_internal::IsHashable<T>::value, H> { return hash_internal::hash_bytes(std::move(state), std::hash<T>{}(value)); } }; @@ -744,7 +744,7 @@ struct HashSelect { // Probe each implementation in order. // disjunction provides short circuiting wrt instantiation. template <typename T> - using Apply = y_absl::disjunction< // + using Apply = y_absl::disjunction< // Probe<UniquelyRepresentedProbe, T>, // Probe<HashValueProbe, T>, // Probe<LegacyHashProbe, T>, // @@ -758,12 +758,12 @@ struct is_hashable // MixingHashState class ABSL_DLL MixingHashState : public HashStateBase<MixingHashState> { - // y_absl::uint128 is not an alias or a thin wrapper around the intrinsic. + // y_absl::uint128 is not an alias or a thin wrapper around the intrinsic. // We use the intrinsic when available to improve performance. #ifdef ABSL_HAVE_INTRINSIC_INT128 using uint128 = __uint128_t; #else // ABSL_HAVE_INTRINSIC_INT128 - using uint128 = y_absl::uint128; + using uint128 = y_absl::uint128; #endif // ABSL_HAVE_INTRINSIC_INT128 static constexpr uint64_t kMul = @@ -799,13 +799,13 @@ class ABSL_DLL MixingHashState : public HashStateBase<MixingHashState> { // Otherwise we would be instantiating and calling dozens of functions for // something that is just one multiplication and a couple xor's. // The result should be the same as running the whole algorithm, but faster. - template <typename T, y_absl::enable_if_t<IntegralFastPath<T>::value, int> = 0> + template <typename T, y_absl::enable_if_t<IntegralFastPath<T>::value, int> = 0> static size_t hash(T value) { return static_cast<size_t>(Mix(Seed(), static_cast<uint64_t>(value))); } // Overload of MixingHashState::hash() - template <typename T, y_absl::enable_if_t<!IntegralFastPath<T>::value, int> = 0> + template <typename T, y_absl::enable_if_t<!IntegralFastPath<T>::value, int> = 0> static size_t hash(const T& value) { return static_cast<size_t>(combine(MixingHashState{}, value).state_); } @@ -905,7 +905,7 @@ class ABSL_DLL MixingHashState : public HashStateBase<MixingHashState> { using MultType = uint64_t; #else using MultType = - y_absl::conditional_t<sizeof(size_t) == 4, uint64_t, uint128>; + y_absl::conditional_t<sizeof(size_t) == 4, uint64_t, uint128>; #endif // We do the addition in 64-bit space to make sure the 128-bit // multiplication is fast. If we were to do it as MultType the compiler has @@ -1032,7 +1032,7 @@ struct HashImpl { template <typename T> struct Hash - : y_absl::conditional_t<is_hashable<T>::value, HashImpl<T>, PoisonedHash> {}; + : y_absl::conditional_t<is_hashable<T>::value, HashImpl<T>, PoisonedHash> {}; template <typename H> template <typename T, typename... Ts> @@ -1091,6 +1091,6 @@ H PiecewiseCombiner::finalize(H state) { } // namespace hash_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_HASH_INTERNAL_HASH_H_ diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/spy_hash_state.h b/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/spy_hash_state.h index 520cbf904f..0172a14f6d 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/spy_hash_state.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/hash/internal/spy_hash_state.h @@ -19,12 +19,12 @@ #include <util/generic/string.h> #include <vector> -#include "y_absl/hash/hash.h" -#include "y_absl/strings/match.h" -#include "y_absl/strings/str_format.h" -#include "y_absl/strings/str_join.h" +#include "y_absl/hash/hash.h" +#include "y_absl/strings/match.h" +#include "y_absl/strings/str_format.h" +#include "y_absl/strings/str_join.h" -namespace y_absl { +namespace y_absl { ABSL_NAMESPACE_BEGIN namespace hash_internal { @@ -40,7 +40,7 @@ namespace hash_internal { template <typename T> class SpyHashStateImpl : public HashStateBase<SpyHashStateImpl<T>> { public: - SpyHashStateImpl() : error_(std::make_shared<y_absl::optional<TString>>()) { + SpyHashStateImpl() : error_(std::make_shared<y_absl::optional<TString>>()) { static_assert(std::is_void<T>::value, ""); } @@ -112,11 +112,11 @@ class SpyHashStateImpl : public HashStateBase<SpyHashStateImpl<T>> { static CompareResult Compare(const SpyHashStateImpl& a, const SpyHashStateImpl& b) { - const TString a_flat = y_absl::StrJoin(a.hash_representation_, ""); - const TString b_flat = y_absl::StrJoin(b.hash_representation_, ""); + const TString a_flat = y_absl::StrJoin(a.hash_representation_, ""); + const TString b_flat = y_absl::StrJoin(b.hash_representation_, ""); if (a_flat == b_flat) return CompareResult::kEqual; - if (y_absl::EndsWith(a_flat, b_flat)) return CompareResult::kBSuffixA; - if (y_absl::EndsWith(b_flat, a_flat)) return CompareResult::kASuffixB; + if (y_absl::EndsWith(a_flat, b_flat)) return CompareResult::kBSuffixA; + if (y_absl::EndsWith(b_flat, a_flat)) return CompareResult::kASuffixB; return CompareResult::kUnequal; } @@ -129,12 +129,12 @@ class SpyHashStateImpl : public HashStateBase<SpyHashStateImpl<T>> { size_t offset = 0; for (char c : s) { if (offset % 16 == 0) { - out << y_absl::StreamFormat("\n0x%04x: ", offset); + out << y_absl::StreamFormat("\n0x%04x: ", offset); } if (offset % 2 == 0) { out << " "; } - out << y_absl::StreamFormat("%02x", c); + out << y_absl::StreamFormat("%02x", c); ++offset; } out << "\n"; @@ -167,7 +167,7 @@ class SpyHashStateImpl : public HashStateBase<SpyHashStateImpl<T>> { using SpyHashStateImpl::HashStateBase::combine_contiguous; - y_absl::optional<TString> error() const { + y_absl::optional<TString> error() const { if (moved_from_) { return "Returned a moved-from instance of the hash state object."; } @@ -183,11 +183,11 @@ class SpyHashStateImpl : public HashStateBase<SpyHashStateImpl<T>> { // AbslHashValue directly (because the hash state type does not match). static bool direct_absl_hash_value_error_; - std::vector<TString> hash_representation_; + std::vector<TString> hash_representation_; // This is a shared_ptr because we want all instances of the particular // SpyHashState run to share the field. This way we can set the error for // use-after-move and all the copies will see it. - std::shared_ptr<y_absl::optional<TString>> error_; + std::shared_ptr<y_absl::optional<TString>> error_; bool moved_from_ = false; }; @@ -212,7 +212,7 @@ bool RunOnStartup<f>::run = (f(), true); template < typename T, typename U, // Only trigger for when (T != U), - typename = y_absl::enable_if_t<!std::is_same<T, U>::value>, + typename = y_absl::enable_if_t<!std::is_same<T, U>::value>, // This statement works in two ways: // - First, it instantiates RunOnStartup and forces the initialization of // `run`, which set the global variable. @@ -226,6 +226,6 @@ using SpyHashState = SpyHashStateImpl<void>; } // namespace hash_internal ABSL_NAMESPACE_END -} // namespace y_absl +} // namespace y_absl #endif // ABSL_HASH_INTERNAL_SPY_HASH_STATE_H_ |