diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-12-02 18:07:47 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-12-02 18:07:47 +0000 |
commit | 090e40fbb3a9e27616fb16fbcff6f9e01dd9b12d (patch) | |
tree | 59b6c094b73f093f2633d0133431ae99a9ca497f /vespalib | |
parent | 5eee8f3baf801d59de8637893799f33075f5fd4d (diff) |
Put the next link at the end to allow closer packing if alignment allows.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/stllike/hashtable.h | 10 |
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> |