aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/string_hash.h
blob: 54eaaf942ae5f5bb1d21504b0919af91d651822c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once

#include <cstddef>

// reduce code bloat and cycled includes, declare functions here
#if defined(_64_)
ui64 CityHash64(const char* buf, size_t len) noexcept;
#else
template <typename T>
T MurmurHash(const void* buf, size_t len) noexcept;
#endif

namespace NHashPrivate {
    template <typename C>
    size_t ComputeStringHash(const C* ptr, size_t size) noexcept {
#if defined(_64_)
        return CityHash64((const char*)ptr, size * sizeof(C));
#else
        return MurmurHash<size_t>(ptr, size * sizeof(C));
#endif
    }
}