summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2021-04-14 14:33:07 +0200
committerTor Egge <Tor.Egge@online.no>2021-04-14 15:42:38 +0200
commit2b7fd317d325795c0d498af5f791a2fa96902973 (patch)
treeb774906bea675d83e86835d07e001e2a33dd4582 /vespalib
parent8ed6273fd8458eb36da7d75413437e6b63ae5aac (diff)
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;
};