diff options
author | bjormel <bjormel@yahooinc.com> | 2023-10-26 13:59:28 +0000 |
---|---|---|
committer | bjormel <bjormel@yahooinc.com> | 2023-10-26 13:59:28 +0000 |
commit | 567be9a1f6353cec41c23bfd1fcd46b4b2a4d2d7 (patch) | |
tree | 4664a743e166a5e11aee7b9acd70ad8ee2617612 /vespalib/src/vespa/vespalib/stllike/hash_fun.h | |
parent | e9058b555d4dfea2f6c872d9a677e8678b569569 (diff) | |
parent | bce3b8e926bf9da880172acbe1ba4b12d5e026d6 (diff) |
Merge branch 'master' into bjormel/aws-main-controllerbjormel/aws-main-controller
Diffstat (limited to 'vespalib/src/vespa/vespalib/stllike/hash_fun.h')
-rw-r--r-- | vespalib/src/vespa/vespalib/stllike/hash_fun.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/vespalib/src/vespa/vespalib/stllike/hash_fun.h b/vespalib/src/vespa/vespalib/stllike/hash_fun.h index daedddbba1b..8fecc41b4c1 100644 --- a/vespalib/src/vespa/vespalib/stllike/hash_fun.h +++ b/vespalib/src/vespa/vespalib/stllike/hash_fun.h @@ -1,8 +1,7 @@ -// 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. #pragma once #include <vespa/vespalib/stllike/string.h> -#include <cstdint> namespace vespalib { @@ -64,9 +63,18 @@ template<typename T> struct hash<const T *> { size_t operator() (const T * arg) const noexcept { return size_t(arg); } }; +namespace xxhash { + +uint64_t xxh3_64(uint64_t value) noexcept; +uint64_t xxh3_64(const void *str, size_t sz) noexcept; + +} + // reuse old string hash function size_t hashValue(const char *str) noexcept; -size_t hashValue(const void *str, size_t sz) noexcept; +inline size_t hashValue(const void *buf, size_t sz) noexcept { + return xxhash::xxh3_64(buf, sz); +} struct hash_strings { size_t operator() (const vespalib::string & arg) const noexcept { return hashValue(arg.data(), arg.size()); } |