summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-12-02 20:03:18 +0100
committerGitHub <noreply@github.com>2020-12-02 20:03:18 +0100
commitb9225bcedc43e911dec73a143f25fc1a064cf1bf (patch)
treecc488716c257d83de5052e8f36f79f92d39d881f
parentc93a7bc06c966b880511073a493a34c7e787f384 (diff)
parent090e40fbb3a9e27616fb16fbcff6f9e01dd9b12d (diff)
Merge pull request #15613 from vespa-engine/balder/reorder-next-for-optionally-closer-packing
Put the next link at the end to allow closer packing if alignment all…
-rw-r--r--vespalib/src/vespa/vespalib/stllike/hashtable.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/vespalib/src/vespa/vespalib/stllike/hashtable.h b/vespalib/src/vespa/vespalib/stllike/hashtable.h
index ba9993c5a37..d9f3ee36dd4 100644
--- a/vespalib/src/vespa/vespalib/stllike/hashtable.h
+++ b/vespalib/src/vespa/vespalib/stllike/hashtable.h
@@ -50,7 +50,7 @@ namespace vespalib {
class hashtable_base
{
public:
- typedef unsigned int next_t;
+ using next_t = uint32_t;
/**
* This is a standard modulator that does modulo/hashTableSize.
* Hashtable size is selected from a a set of prime numbers.
@@ -98,11 +98,11 @@ class hash_node {
public:
using next_t=hashtable_base::next_t;
enum {npos=-1u, invalid=-2u};
- hash_node() : _next(invalid) {}
+ hash_node() : _node(), _next(invalid) {}
hash_node(const V & node, next_t next=npos)
- : _next(next), _node(node) {}
+ : _node(node), _next(next) {}
hash_node(V &&node, next_t next=npos)
- : _next(next), _node(std::move(node)) {}
+ : _node(std::move(node)), _next(next) {}
hash_node(hash_node &&) noexcept = default;
hash_node &operator=(hash_node &&) noexcept = default;
hash_node(const hash_node &) = default; // These will not be created
@@ -119,8 +119,8 @@ public:
bool valid() const { return _next != invalid; }
bool hasNext() const { return valid() && (_next != npos); }
private:
- next_t _next;
V _node;
+ next_t _next;
};
template< typename Key, typename Value, typename Hash, typename Equal, typename KeyExtract, typename Modulator = hashtable_base::prime_modulator>