diff options
author | dobrokot <dobrokot@yandex-team.ru> | 2022-02-10 16:49:07 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:07 +0300 |
commit | 8d57b69dee81198a59c39e64704f7dc9f04b4fbf (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/digest | |
parent | 25d83bf841d8b3ce3886525078f1964ac3c293c5 (diff) | |
download | ydb-8d57b69dee81198a59c39e64704f7dc9f04b4fbf.tar.gz |
Restoring authorship annotation for <dobrokot@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/digest')
-rw-r--r-- | util/digest/city.cpp | 6 | ||||
-rw-r--r-- | util/digest/city.h | 32 | ||||
-rw-r--r-- | util/digest/murmur.cpp | 4 | ||||
-rw-r--r-- | util/digest/murmur.h | 2 | ||||
-rw-r--r-- | util/digest/murmur_ut.cpp | 2 |
5 files changed, 23 insertions, 23 deletions
diff --git a/util/digest/city.cpp b/util/digest/city.cpp index 566b66aa48..c25f175d54 100644 --- a/util/digest/city.cpp +++ b/util/digest/city.cpp @@ -311,13 +311,13 @@ uint128 CityHash128(const char* s, size_t len) noexcept { } // TODO(yazevnul): move this function to unittests -void TestCompilationOfCityHashTemplates() { +void TestCompilationOfCityHashTemplates() { TStringBuf s; CityHash64(s); CityHash64WithSeed(s, 1); CityHash64WithSeeds(s, 1, 2); CityHash128(s); CityHash128WithSeed(s, uint128(1, 2)); -} - +} + #endif diff --git a/util/digest/city.h b/util/digest/city.h index 77ecba67a2..675a798074 100644 --- a/util/digest/city.h +++ b/util/digest/city.h @@ -1,7 +1,7 @@ #pragma once #include <util/generic/utility.h> -#include <util/generic/strbuf.h> +#include <util/generic/strbuf.h> #include <utility> @@ -18,9 +18,9 @@ constexpr ui64 Uint128High64(const uint128& x) { return x.second; } -// Hash functions for a byte array. -// http://en.wikipedia.org/wiki/CityHash - +// Hash functions for a byte array. +// http://en.wikipedia.org/wiki/CityHash + Y_PURE_FUNCTION ui64 CityHash64(const char* buf, size_t len) noexcept; Y_PURE_FUNCTION ui64 CityHash64WithSeed(const char* buf, size_t len, ui64 seed) noexcept; @@ -43,41 +43,41 @@ inline ui64 Hash128to64(const uint128& x) { b *= kMul; return b; } - + namespace NPrivateCityHash { template <class TStringType> inline TStringBuf GetBufFromStr(const TStringType& str) { static_assert(std::is_integral<std::remove_reference_t<decltype(*str.data())>>::value, "invalid type passed to hash function"); return TStringBuf(reinterpret_cast<const char*>(str.data()), (str.size()) * sizeof(*str.data())); } -} - +} + template <class TStringType> inline ui64 CityHash64(const TStringType& str) { TStringBuf buf = NPrivateCityHash::GetBufFromStr(str); return CityHash64(buf.data(), buf.size()); -} - +} + template <class TStringType> inline ui64 CityHash64WithSeeds(const TStringType& str, ui64 seed0, ui64 seed1) { TStringBuf buf = NPrivateCityHash::GetBufFromStr(str); return CityHash64WithSeeds(buf.data(), buf.size(), seed0, seed1); -} - +} + template <class TStringType> inline ui64 CityHash64WithSeed(const TStringType& str, ui64 seed) { TStringBuf buf = NPrivateCityHash::GetBufFromStr(str); return CityHash64WithSeed(buf.data(), buf.size(), seed); -} - +} + template <class TStringType> inline uint128 CityHash128(const TStringType& str) { TStringBuf buf = NPrivateCityHash::GetBufFromStr(str); return CityHash128(buf.data(), buf.size()); -} - +} + template <class TStringType> inline uint128 CityHash128WithSeed(const TStringType& str, uint128 seed) { TStringBuf buf = NPrivateCityHash::GetBufFromStr(str); return CityHash128WithSeed(buf.data(), buf.size(), seed); -} +} diff --git a/util/digest/murmur.cpp b/util/digest/murmur.cpp index 22ef50014e..b041d3e5f2 100644 --- a/util/digest/murmur.cpp +++ b/util/digest/murmur.cpp @@ -1,5 +1,5 @@ -#include "murmur.h" - +#include "murmur.h" + #include <util/system/unaligned_mem.h> namespace NMurmurPrivate { diff --git a/util/digest/murmur.h b/util/digest/murmur.h index 87ad2c2d4c..6b519b430a 100644 --- a/util/digest/murmur.h +++ b/util/digest/murmur.h @@ -36,7 +36,7 @@ static inline T MurmurHash(const void* buf, size_t len, T init) noexcept { template <class T> static inline T MurmurHash(const void* buf, size_t len) noexcept { - return MurmurHash<T>(buf, len, (T)0); + return MurmurHash<T>(buf, len, (T)0); } //non-inline version diff --git a/util/digest/murmur_ut.cpp b/util/digest/murmur_ut.cpp index 0316264e72..29287668bc 100644 --- a/util/digest/murmur_ut.cpp +++ b/util/digest/murmur_ut.cpp @@ -1,4 +1,4 @@ - + #include "murmur.h" #include <library/cpp/testing/unittest/registar.h> |