diff options
Diffstat (limited to 'document')
-rw-r--r-- | document/src/vespa/document/bucket/bucketid.cpp | 8 | ||||
-rw-r--r-- | document/src/vespa/document/bucket/bucketid.h | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/document/src/vespa/document/bucket/bucketid.cpp b/document/src/vespa/document/bucket/bucketid.cpp index f01bfb67674..3752eab4810 100644 --- a/document/src/vespa/document/bucket/bucketid.cpp +++ b/document/src/vespa/document/bucket/bucketid.cpp @@ -8,6 +8,7 @@ #include <vespa/vespalib/stllike/hash_set.hpp> #include <vespa/vespalib/util/stringfmt.h> #include <limits> +#include <xxh3.h> using vespalib::nbostream; using vespalib::asciistream; @@ -76,6 +77,12 @@ void BucketId::initialize() noexcept { fillStripMasks(BucketId::_stripMasks, BucketId::maxNumBits); } +uint64_t +BucketId::xxhash::operator () (const BucketId& bucketId) const noexcept { + const uint64_t raw_id = bucketId.getId(); + return XXH3_64bits(&raw_id, sizeof(uint64_t)); +} + vespalib::string BucketId::toString() const { @@ -152,3 +159,4 @@ operator>>(nbostream &is, BucketId &bucketId) } // document VESPALIB_HASH_SET_INSTANTIATE_H(document::BucketId, document::BucketId::hash); +VESPALIB_HASH_SET_INSTANTIATE_H(document::BucketId, document::BucketId::xxhash); diff --git a/document/src/vespa/document/bucket/bucketid.h b/document/src/vespa/document/bucket/bucketid.h index d54f86e4ae7..a0f9ca4e94f 100644 --- a/document/src/vespa/document/bucket/bucketid.h +++ b/document/src/vespa/document/bucket/bucketid.h @@ -41,6 +41,9 @@ public: return g.getId(); } }; + struct xxhash { + uint64_t operator () (const BucketId& g) const noexcept; + }; /** * The primitive type used to store bucket identifiers. If you use the |