aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/stllike/hash_fun.cpp
blob: 04eee6801cc1a0e86d9a68e617a8274aa75494de (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
27
28
// Copyright Yahoo. 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 hashValue(str, strlen(str));
}

/**
 * @brief Calculate hash value.
 *
 * The hash function XXH3_64bits from xxhash library.
 * @param buf input buffer
 * @param sz input buffer size
 * @return hash value of input
 **/
size_t
hashValue(const void * buf, size_t sz) noexcept
{
    return XXH3_64bits(buf, sz);
}

}