aboutsummaryrefslogtreecommitdiffstats
path: root/util/digest/city_streaming.h
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2024-11-20 11:14:58 +0000
committerAlexander Smirnov <alex@ydb.tech>2024-11-20 11:14:58 +0000
commit31773f157bf8164364649b5f470f52dece0a4317 (patch)
tree33d0f7eef45303ab68cf08ab381ce5e5e36c5240 /util/digest/city_streaming.h
parent2c7938962d8689e175574fc1e817c05049f27905 (diff)
parenteff600952d5dfe17942f38f510a8ac2b203bb3a5 (diff)
downloadydb-31773f157bf8164364649b5f470f52dece0a4317.tar.gz
Merge branch 'rightlib' into mergelibs-241120-1113
Diffstat (limited to 'util/digest/city_streaming.h')
-rw-r--r--util/digest/city_streaming.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/util/digest/city_streaming.h b/util/digest/city_streaming.h
new file mode 100644
index 0000000000..f9c5209e0a
--- /dev/null
+++ b/util/digest/city_streaming.h
@@ -0,0 +1,21 @@
+#pragma once
+#include <util/digest/city.h>
+
+/**
+ * (partially) streaming version of CityHash64 for large data.
+ * You need to know length and first/last 64 bytes.
+ * Those bytes should be passed twice: in constructor and thru process().
+ * Length must be STRICTLY larger than 64 bytes.
+ * XXX: Dont use CityHash64 if you can use something else and need streaming
+ */
+class TStreamingCityHash64 {
+ ui64 x, y, z;
+ std::pair<ui64, ui64> v, w;
+ char UnalignBuf_[64];
+ size_t UnalignBufSz_, Rest64_;
+
+public:
+ TStreamingCityHash64(size_t len, const char* head64, const char* tail64);
+ void Process(const char* s, size_t avail);
+ ui64 operator()();
+};