aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/stllike/hash_fun.cpp
blob: 6802e5f91a63fd6c17bfaf2c6e1270ed4ec26241 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "hash_fun.h"
#include <xxhash.h>

namespace vespalib {

size_t
hashValue(const char *str) noexcept {
    return xxhash::xxh3_64(str, strlen(str));
}

namespace xxhash {

uint64_t
xxh3_64(uint64_t value) noexcept {
    return XXH3_64bits(&value, sizeof(value));
}

uint64_t
xxh3_64(const void * buf, size_t sz) noexcept {
    return XXH3_64bits(buf, sz);
}

}
}