summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-04-14 16:43:19 +0200
committerGitHub <noreply@github.com>2021-04-14 16:43:19 +0200
commit1fe8a07b0fa08dcb212c86eb8d4d3a330fab471c (patch)
tree9d82820994734780ae927d9afdb9536b0c44f6b6 /vespalib
parent205027ee37315c838faa63bb303671f4fd0145b3 (diff)
parent2b7fd317d325795c0d498af5f791a2fa96902973 (diff)
Merge pull request #17428 from vespa-engine/toregge/move-alignas-to-proper-position
Move alignas to proper position.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/tests/stllike/hash_test.cpp7
-rw-r--r--vespalib/src/vespa/vespalib/stllike/hashtable.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/vespalib/src/tests/stllike/hash_test.cpp b/vespalib/src/tests/stllike/hash_test.cpp
index 59081c0ab73..5643fac52bf 100644
--- a/vespalib/src/tests/stllike/hash_test.cpp
+++ b/vespalib/src/tests/stllike/hash_test.cpp
@@ -582,4 +582,11 @@ TEST("test that hash table clear does not resize hashtable") {
EXPECT_EQUAL(128u, a.capacity());
}
+TEST("test that hash nodes have expected sizes")
+{
+ EXPECT_EQUAL(8u, sizeof(hash_node<int8_t>));
+ EXPECT_EQUAL(8u, sizeof(hash_node<int32_t>));
+ EXPECT_EQUAL(16u, sizeof(hash_node<int64_t>));
+}
+
TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/vespalib/src/vespa/vespalib/stllike/hashtable.h b/vespalib/src/vespa/vespalib/stllike/hashtable.h
index 1a982b97208..b94672aaa06 100644
--- a/vespalib/src/vespa/vespalib/stllike/hashtable.h
+++ b/vespalib/src/vespa/vespalib/stllike/hashtable.h
@@ -172,7 +172,7 @@ private:
}
}
}
- char _node[sizeof(V)] alignas(V);
+ alignas(V) char _node[sizeof(V)];
next_t _next;
};