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/internal | |
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/internal')
5 files changed, 72 insertions, 72 deletions
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_ |