CppTrader  1.0.4.0
C++ Trader
fast_hash.inl
Go to the documentation of this file.
1 
9 namespace CppTrader {
10 namespace Matching {
11 
12 inline size_t FastHash::operator()(uint64_t value) const noexcept
13 {
14  value ^= value >> 33;
15  value *= 0xFF51AFD7ED558CCD;
16  value ^= value >> 33;
17  value *= 0xC4CEB9FE1A85EC53;
18  value ^= value >> 33;
19  return value;
20 }
21 
22 inline uint64_t FastHash::Parse(const char str[8]) noexcept
23 {
24  uint64_t value = 0;
25  value |= ((uint64_t)str[0]);
26  value |= ((uint64_t)str[1]) << 8;
27  value |= ((uint64_t)str[2]) << 16;
28  value |= ((uint64_t)str[3]) << 24;
29  value |= ((uint64_t)str[4]) << 32;
30  value |= ((uint64_t)str[5]) << 40;
31  value |= ((uint64_t)str[6]) << 48;
32  value |= ((uint64_t)str[7]) << 56;
33  return value;
34 }
35 
36 } // namespace Matching
37 } // namespace CppTrader
static uint64_t Parse(const char str[8]) noexcept
Parse fixed size string value and return its 64-bit integer equivalent.
Definition: fast_hash.inl:22
size_t operator()(uint64_t value) const noexcept
Calculate hash value.
Definition: fast_hash.inl:12
C++ Trader project definitions.
Definition: errors.h:16