aboutsummaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-03-16 00:38:51 +0300
committerarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-03-16 00:38:51 +0300
commita41dfff10a0a0f3ab8b7b46a01d61fedab3bf768 (patch)
treeee9173c30b324a731d5c02012bcd101581bbc8b0 /library
parent428ee57c143798426140bc229ec50c4d007fef8b (diff)
downloadydb-a41dfff10a0a0f3ab8b7b46a01d61fedab3bf768.tar.gz
intermediate changes
ref:38a8ea5b493bef3b2e624055e6a04d33164137a9
Diffstat (limited to 'library')
-rw-r--r--library/cpp/yt/misc/farm_hash.h54
-rw-r--r--library/cpp/yt/misc/unittests/farm_fingerprint_stability_ut.cpp39
2 files changed, 0 insertions, 93 deletions
diff --git a/library/cpp/yt/misc/farm_hash.h b/library/cpp/yt/misc/farm_hash.h
deleted file mode 100644
index be18b3bfc2..0000000000
--- a/library/cpp/yt/misc/farm_hash.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#pragma once
-
-#include <contrib/libs/farmhash/farmhash.h>
-
-namespace NYT {
-
-using TFingerprint = ui64;
-
-////////////////////////////////////////////////////////////////////////////////
-
-static inline TFingerprint FarmHash(ui64 value)
-{
- return ::util::Fingerprint(value);
-}
-
-static inline TFingerprint FarmHash(const void* buf, size_t len)
-{
- return ::util::Hash64(static_cast<const char*>(buf), len);
-}
-
-static inline TFingerprint FarmHash(const void* buf, size_t len, ui64 seed)
-{
- return ::util::Hash64WithSeed(static_cast<const char*>(buf), len, seed);
-}
-
-static inline TFingerprint FarmFingerprint(ui64 value)
-{
- return ::util::Fingerprint(value);
-}
-
-static inline TFingerprint FarmFingerprint(const void* buf, size_t len)
-{
- return ::util::Fingerprint64(static_cast<const char*>(buf), len);
-}
-
-static inline TFingerprint FarmFingerprint(ui64 first, ui64 second)
-{
- return ::util::Fingerprint(::util::Uint128(first, second));
-}
-
-// Forever-fixed Google FarmHash fingerprint.
-template <class T>
-TFingerprint FarmFingerprint(const T* begin, const T* end)
-{
- ui64 result = 0xdeadc0de;
- for (const auto* value = begin; value < end; ++value) {
- result = FarmFingerprint(result, FarmFingerprint(*value));
- }
- return result ^ (end - begin);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-} // namespace NYT
diff --git a/library/cpp/yt/misc/unittests/farm_fingerprint_stability_ut.cpp b/library/cpp/yt/misc/unittests/farm_fingerprint_stability_ut.cpp
deleted file mode 100644
index 77726661ee..0000000000
--- a/library/cpp/yt/misc/unittests/farm_fingerprint_stability_ut.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <yt/yt/core/test_framework/framework.h>
-
-#include <yt/yt/core/misc/farm_hash.h>
-
-namespace NYT {
-namespace {
-
-/////////////////////////////////////////////////////////////////////////////
-/*
- * NB: This provides a sanity check for stability
- * of FarmHash and FarmFingerprint functions.
- */
-
-TEST(TFarmHashTest, Test)
-{
- // NB: At the time of creation of this test, FarmHash function relied on
- // FarmFingerprint, however we do not require it, so this test is more or less a sanity check.
- static_assert(std::is_same<ui64, decltype(FarmHash(42ULL))>::value);
- EXPECT_EQ(17355217915646310598ULL, FarmHash(42ULL));
-}
-
-TEST(TFarmFingerprintTest, Test)
-{
- static_assert(std::is_same<ui64, decltype(FarmFingerprint(42ULL))>::value);
- EXPECT_EQ(17355217915646310598ULL, FarmFingerprint(42ULL));
-
- TString buf = "MDwhat?";
-
- static_assert(std::is_same<ui64, decltype(FarmFingerprint(buf.Data(), buf.Size()))>::value);
- EXPECT_EQ(10997514911242581312ULL, FarmFingerprint(buf.Data(), buf.Size()));
-
- static_assert(std::is_same<ui64, decltype(FarmFingerprint(1234ULL, 5678ULL))>::value);
- EXPECT_EQ(16769064555670434975ULL, FarmFingerprint(1234ULL, 5678ULL));
-}
-
-/////////////////////////////////////////////////////////////////////////////
-
-} // namespace
-} // namespace NYT