summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-06-09 09:08:56 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-06-09 09:08:56 +0000
commit4e90b78dd51b7d7387b9a8ccd2c2036f78dd65c5 (patch)
tree28edaadb755989b8df6aa792a6aaa0bc8cb9423a /vespalib
parentbebe03c7b970744d09eb26f7383da4f8c1244a36 (diff)
Add static_assert for sanity of template arguments.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/hwaccelrated/private_helpers.hpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/private_helpers.hpp b/vespalib/src/vespa/vespalib/hwaccelrated/private_helpers.hpp
index 6fc49f969f2..65b4c717681 100644
--- a/vespalib/src/vespa/vespalib/hwaccelrated/private_helpers.hpp
+++ b/vespalib/src/vespa/vespalib/hwaccelrated/private_helpers.hpp
@@ -40,6 +40,8 @@ template<unsigned ChunkSize, unsigned Chunks>
void
andChunks(size_t offset, const std::vector<std::pair<const void *, bool>> & src, void * dest) {
typedef uint64_t Chunk __attribute__ ((vector_size (ChunkSize)));
+ static_assert(sizeof(Chunk) == ChunkSize, "sizeof(Chunk) == ChunkSize");
+ static_assert(ChunkSize*Chunks == 64, "ChunkSize*Chunks == 64");
Chunk * chunk = static_cast<Chunk *>(dest);
const Chunk * tmp = cast<Chunk>(src[0].first, offset);
for (size_t n=0; n < Chunks; n++) {
@@ -57,6 +59,8 @@ template<unsigned ChunkSize, unsigned Chunks>
void
orChunks(size_t offset, const std::vector<std::pair<const void *, bool>> & src, void * dest) {
typedef uint64_t Chunk __attribute__ ((vector_size (ChunkSize)));
+ static_assert(sizeof(Chunk) == ChunkSize, "sizeof(Chunk) == ChunkSize");
+ static_assert(ChunkSize*Chunks == 64, "ChunkSize*Chunks == 64");
Chunk * chunk = static_cast<Chunk *>(dest);
const Chunk * tmp = cast<Chunk>(src[0].first, offset);
for (size_t n=0; n < Chunks; n++) {