bloaty/third_party/abseil-cpp/absl/hash/internal/hash.cc
Go to the documentation of this file.
1 // Copyright 2018 The Abseil Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "absl/hash/internal/hash.h"
16 
17 namespace absl {
19 namespace hash_internal {
20 
22  const unsigned char* first,
23  size_t len) {
24  while (len >= PiecewiseChunkSize()) {
25  state =
26  Mix(state, absl::hash_internal::CityHash32(reinterpret_cast<const char*>(first),
30  }
31  // Handle the remainder.
33  std::integral_constant<int, 4>{});
34 }
35 
37  const unsigned char* first,
38  size_t len) {
39  while (len >= PiecewiseChunkSize()) {
43  }
44  // Handle the remainder.
46  std::integral_constant<int, 8>{});
47 }
48 
49 ABSL_CONST_INIT const void* const HashState::kSeed = &kSeed;
50 
51 // The salt array used by Wyhash. This array is NOT the mechanism used to make
52 // absl::Hash non-deterministic between program invocations. See `Seed()` for
53 // that mechanism.
54 //
55 // Any random values are fine. These values are just digits from the decimal
56 // part of pi.
57 // https://en.wikipedia.org/wiki/Nothing-up-my-sleeve_number
58 constexpr uint64_t kWyhashSalt[5] = {
59  uint64_t{0x243F6A8885A308D3}, uint64_t{0x13198A2E03707344},
60  uint64_t{0xA4093822299F31D0}, uint64_t{0x082EFA98EC4E6C89},
61  uint64_t{0x452821E638D01377},
62 };
63 
64 uint64_t HashState::WyhashImpl(const unsigned char* data, size_t len) {
65  return Wyhash(data, len, Seed(), kWyhashSalt);
66 }
67 
68 } // namespace hash_internal
70 } // namespace absl
ABSL_CONST_INIT
#define ABSL_CONST_INIT
Definition: abseil-cpp/absl/base/attributes.h:716
ABSL_NAMESPACE_END
#define ABSL_NAMESPACE_END
Definition: third_party/abseil-cpp/absl/base/config.h:171
ABSL_NAMESPACE_BEGIN
#define ABSL_NAMESPACE_BEGIN
Definition: third_party/abseil-cpp/absl/base/config.h:170
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
absl::hash_internal::kWyhashSalt
constexpr uint64_t kWyhashSalt[5]
Definition: bloaty/third_party/abseil-cpp/absl/hash/internal/hash.cc:58
absl::hash_internal::data
static char data[kDataSize]
Definition: bloaty/third_party/abseil-cpp/absl/hash/internal/city_test.cc:32
absl::hash_internal::HashState::WyhashImpl
static uint64_t WyhashImpl(const unsigned char *data, size_t len)
Definition: bloaty/third_party/abseil-cpp/absl/hash/internal/hash.cc:64
absl::hash_internal::PiecewiseChunkSize
constexpr size_t PiecewiseChunkSize()
Definition: abseil-cpp/absl/hash/internal/hash.h:67
absl::hash_internal::HashState::CombineLargeContiguousImpl64
static uint64_t CombineLargeContiguousImpl64(uint64_t state, const unsigned char *first, size_t len)
Definition: bloaty/third_party/abseil-cpp/absl/hash/internal/hash.cc:36
absl::hash_internal::HashState::kSeed
static const void *const kSeed
Definition: bloaty/third_party/abseil-cpp/absl/hash/internal/hash.h:909
absl::hash_internal::Wyhash
uint64_t Wyhash(const void *data, size_t len, uint64_t seed, const uint64_t salt[])
Definition: wyhash.cc:30
first
StrT first
Definition: cxa_demangle.cpp:4884
state
Definition: bloaty/third_party/zlib/contrib/blast/blast.c:41
absl
Definition: abseil-cpp/absl/algorithm/algorithm.h:31
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
absl::hash_internal::HashState::CombineLargeContiguousImpl32
static uint64_t CombineLargeContiguousImpl32(uint64_t state, const unsigned char *first, size_t len)
Definition: bloaty/third_party/abseil-cpp/absl/hash/internal/hash.cc:21
absl::hash_internal::HashState::CombineContiguousImpl
static uint64_t CombineContiguousImpl(uint64_t state, const unsigned char *first, size_t len, std::integral_constant< int, 4 >)
Definition: bloaty/third_party/abseil-cpp/absl/hash/internal/hash.h:915
absl::hash_internal::HashState::Seed
static ABSL_ATTRIBUTE_ALWAYS_INLINE uint64_t Seed()
Definition: bloaty/third_party/abseil-cpp/absl/hash/internal/hash.h:899
absl::hash_internal::CityHash32
uint32_t CityHash32(const char *s, size_t len)
Definition: abseil-cpp/absl/hash/internal/city.cc:124
absl::hash_internal::HashState::Mix
static ABSL_ATTRIBUTE_ALWAYS_INLINE uint64_t Mix(uint64_t state, uint64_t v)
Definition: bloaty/third_party/abseil-cpp/absl/hash/internal/hash.h:858
absl::hash_internal::HashState::Hash64
static ABSL_ATTRIBUTE_ALWAYS_INLINE uint64_t Hash64(const unsigned char *data, size_t len)
Definition: bloaty/third_party/abseil-cpp/absl/hash/internal/hash.h:874


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:00