grpc
third_party
bloaty
third_party
re2
util
bloaty/third_party/re2/util/mix.h
Go to the documentation of this file.
1
// Copyright 2016 The RE2 Authors. All Rights Reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4
5
#ifndef UTIL_MIX_H_
6
#define UTIL_MIX_H_
7
8
#include <stddef.h>
9
#include <limits>
10
11
namespace
re2
{
12
13
// Silence "truncation of constant value" warning for kMul in 32-bit mode.
14
// Since this is a header file, push and then pop to limit the scope.
15
#ifdef _MSC_VER
16
#pragma warning(push)
17
#pragma warning(disable: 4309)
18
#endif
19
20
class
HashMix
{
21
public
:
22
HashMix
() :
hash_
(1) {}
23
explicit
HashMix
(
size_t
val) :
hash_
(val + 83) {}
24
void
Mix
(
size_t
val) {
25
static
const
size_t
kMul =
static_cast<
size_t
>
(0xdc3eb94af8ab4c93
ULL
);
26
hash_
*= kMul;
27
hash_
= ((
hash_
<< 19) |
28
(
hash_
>> (std::numeric_limits<size_t>::digits - 19))) + val;
29
}
30
size_t
get
()
const
{
return
hash_
; }
31
private
:
32
size_t
hash_
;
33
};
34
35
#ifdef _MSC_VER
36
#pragma warning(pop)
37
#endif
38
39
}
// namespace re2
40
41
#endif // UTIL_MIX_H_
re2::HashMix::get
size_t get() const
Definition:
bloaty/third_party/re2/util/mix.h:30
re2::HashMix::HashMix
HashMix(size_t val)
Definition:
bloaty/third_party/re2/util/mix.h:23
re2
Definition:
bloaty/third_party/re2/re2/bitmap256.h:17
re2::HashMix
Definition:
bloaty/third_party/re2/util/mix.h:20
ULL
#define ULL(x)
Definition:
bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream_unittest.cc:57
re2::HashMix::hash_
size_t hash_
Definition:
bloaty/third_party/re2/util/mix.h:32
re2::HashMix::Mix
void Mix(size_t val)
Definition:
bloaty/third_party/re2/util/mix.h:24
re2::HashMix::HashMix
HashMix()
Definition:
bloaty/third_party/re2/util/mix.h:22
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:29