/src/rocksdb/util/hash128.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. |
2 | | // This source code is licensed under both the GPLv2 (found in the |
3 | | // COPYING file in the root directory) and Apache 2.0 License |
4 | | // (found in the LICENSE.Apache file in the root directory). |
5 | | |
6 | | #pragma once |
7 | | |
8 | | // 128-bit hash gets it own header so that more popular hash.h doesn't |
9 | | // depend on math128.h |
10 | | |
11 | | #include "rocksdb/slice.h" |
12 | | #include "util/math128.h" |
13 | | |
14 | | namespace ROCKSDB_NAMESPACE { |
15 | | |
16 | | // Stable/persistent 128-bit hash for non-cryptographic applications. |
17 | | Unsigned128 Hash128(const char* data, size_t n, uint64_t seed); |
18 | | |
19 | | // Specific optimization without seed (same as seed = 0) |
20 | | Unsigned128 Hash128(const char* data, size_t n); |
21 | | |
22 | 0 | inline Unsigned128 GetSliceHash128(const Slice& key) { |
23 | 0 | return Hash128(key.data(), key.size()); |
24 | 0 | } |
25 | | |
26 | | } // namespace ROCKSDB_NAMESPACE |