aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/string_hash.h
blob: 23f1798c6889e9f8dce6191cf02bdbc7567bb0c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once 
 
#include <cstddef> 
 
// reduce code bloat and cycled includes, declare functions here 
#if defined(_64_) && !defined(NO_CITYHASH) 
ui64 CityHash64(const char* buf, size_t len) noexcept; 
#else 
size_t MurmurHashSizeT(const char* buf, size_t len) noexcept; 
#endif 
 
namespace NHashPrivate { 
    template <typename C> 
    size_t ComputeStringHash(const C* ptr, size_t size) noexcept { 
#if defined(_64_) && !defined(NO_CITYHASH) 
        return CityHash64((const char*)ptr, size * sizeof(C));
#else 
        return MurmurHashSizeT((const char*)ptr, size * sizeof(C));
#endif 
    } 
}