Adds runtime alignment assertions, see #3267

This commit is contained in:
Daniel J. Hofmann
2016-11-09 00:23:38 +01:00
committed by Patrick Niklaus
parent 7dea7476f1
commit 559c88b36d
3 changed files with 23 additions and 2 deletions
+1
View File
@@ -106,6 +106,7 @@ struct DataLayout
template <typename T> inline void SetBlockSize(BlockID bid, uint64_t entries)
{
static_assert(sizeof(T) % alignof(T) == 0, "aligned T* can't be used as an array pointer");
num_entries[bid] = entries;
entry_size[bid] = sizeof(T);
entry_align[bid] = alignof(T);