line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#pragma once |
2
|
|
|
|
|
|
|
#include |
3
|
|
|
|
|
|
|
#include |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
namespace panda { namespace lib { |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
uint64_t hash_murmur64a (const char* str, size_t len); |
8
|
|
|
|
|
|
|
uint32_t hash_jenkins_one_at_a_time (const char* str, size_t len); |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
|
|
|
inline uint64_t hash64 (const char* str, size_t len) { return hash_murmur64a(str, len); } |
11
|
2
|
|
|
|
|
|
inline uint32_t hash32 (const char* str, size_t len) { return hash_jenkins_one_at_a_time(str, len); } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
namespace { |
14
|
|
|
|
|
|
|
template struct _hashXX; |
15
|
|
|
|
|
|
|
template <> struct _hashXX<4> { uint32_t operator() (const char* str, size_t len) { return hash32(str, len); } }; |
16
|
|
|
|
|
|
|
template <> struct _hashXX<8> { uint64_t operator() (const char* str, size_t len) { return hash64(str, len); } }; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
template inline T hashXX (const char* str, size_t len); |
20
|
|
|
|
|
|
|
template <> inline unsigned hashXX (const char* str, size_t len) { return _hashXX()(str, len); } |
21
|
|
|
|
|
|
|
template <> inline unsigned long hashXX (const char* str, size_t len) { return _hashXX()(str, len); } |
22
|
|
|
|
|
|
|
template <> inline unsigned long long hashXX (const char* str, size_t len) { return _hashXX()(str, len); } |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
}} |