aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/stllike/hash_fun.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'vespalib/src/vespa/vespalib/stllike/hash_fun.cpp')
-rw-r--r--vespalib/src/vespa/vespalib/stllike/hash_fun.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/vespalib/src/vespa/vespalib/stllike/hash_fun.cpp b/vespalib/src/vespa/vespalib/stllike/hash_fun.cpp
index 04eee6801cc..6802e5f91a6 100644
--- a/vespalib/src/vespa/vespalib/stllike/hash_fun.cpp
+++ b/vespalib/src/vespa/vespalib/stllike/hash_fun.cpp
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// 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>
@@ -6,23 +6,21 @@
namespace vespalib {
size_t
-hashValue(const char *str) noexcept
-{
- return hashValue(str, strlen(str));
+hashValue(const char *str) noexcept {
+ return xxhash::xxh3_64(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
-{
+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);
}
}
+}