EtcPal
HEAD (unstable)
ETC Platform Abstraction Layer (EtcPal)
View other versions:
hash.h
1
/******************************************************************************
2
* Copyright 2022 ETC Inc.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*******************************************************************************
16
* This file is a part of EtcPal. For more information, go to:
17
* https://github.com/ETCLabs/EtcPal
18
******************************************************************************/
19
22
23
#ifndef ETCPAL_CPP_HASH_H_
24
#define ETCPAL_CPP_HASH_H_
25
26
#include <cstddef>
27
#include <functional>
28
29
namespace
etcpal
30
{
34
51
template
<
class
T>
52
inline
void
HashCombine
(
size_t
& seed,
const
T& val)
53
{
54
std::hash<T> hasher;
55
seed ^= hasher(val) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
56
}
57
58
};
// namespace etcpal
59
60
#endif
/* ETCPAL_CPP_HASH_H_ */
etcpal::HashCombine
void HashCombine(size_t &seed, const T &val)
A function that combines the hash of a new value into an existing seed, based on boost::hash_combine.
Definition:
hash.h:52
include
etcpal
cpp
hash.h
Generated by
1.9.1