Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:27:18

0001 // Copyright 2020 The Abseil Authors
0002 //
0003 // Licensed under the Apache License, Version 2.0 (the "License");
0004 // you may not use this file except in compliance with the License.
0005 // You may obtain a copy of the License at
0006 //
0007 //     https://www.apache.org/licenses/LICENSE-2.0
0008 //
0009 // Unless required by applicable law or agreed to in writing, software
0010 // distributed under the License is distributed on an "AS IS" BASIS,
0011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0012 // See the License for the specific language governing permissions and
0013 // limitations under the License.
0014 //
0015 // This file provides the Google-internal implementation of LowLevelHash.
0016 //
0017 // LowLevelHash is a fast hash function for hash tables, the fastest we've
0018 // currently (late 2020) found that passes the SMHasher tests. The algorithm
0019 // relies on intrinsic 128-bit multiplication for speed. This is not meant to be
0020 // secure - just fast.
0021 //
0022 // It is closely based on a version of wyhash, but does not maintain or
0023 // guarantee future compatibility with it.
0024 
0025 #ifndef ABSL_HASH_INTERNAL_LOW_LEVEL_HASH_H_
0026 #define ABSL_HASH_INTERNAL_LOW_LEVEL_HASH_H_
0027 
0028 #include <stdint.h>
0029 #include <stdlib.h>
0030 
0031 #include "absl/base/config.h"
0032 
0033 namespace absl {
0034 ABSL_NAMESPACE_BEGIN
0035 namespace hash_internal {
0036 
0037 // Hash function for a byte array. A 64-bit seed and a set of five 64-bit
0038 // integers are hashed into the result.
0039 //
0040 // To allow all hashable types (including string_view and Span) to depend on
0041 // this algorithm, we keep the API low-level, with as few dependencies as
0042 // possible.
0043 uint64_t LowLevelHash(const void* data, size_t len, uint64_t seed,
0044                       const uint64_t salt[5]);
0045 
0046 // Same as above except the length must be greater than 16.
0047 uint64_t LowLevelHashLenGt16(const void* data, size_t len, uint64_t seed,
0048                              const uint64_t salt[5]);
0049 
0050 }  // namespace hash_internal
0051 ABSL_NAMESPACE_END
0052 }  // namespace absl
0053 
0054 #endif  // ABSL_HASH_INTERNAL_LOW_LEVEL_HASH_H_