diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-05-12 12:56:19 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-05-12 13:02:45 +0300 |
commit | 3a5501d168d75f0611e82ac7ba03d8a723a77a9f (patch) | |
tree | 12296cc9120a594b5a2fdd53137a223d9a172a76 /source/blender/blenlib | |
parent | 20881a7794942d70a84977eafecacd5c8bb58e86 (diff) |
Use static assert in Clay engine to ensure struct alignment
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 746eb922c65..72ac6bd0080 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -674,6 +674,9 @@ extern bool BLI_memory_is_zero(const void *arr, const size_t arr_size); # define BLI_STATIC_ASSERT(a, msg) #endif +#define BLI_STATIC_ASSERT_ALIGN(st, align) \ + BLI_STATIC_ASSERT((sizeof(st) % (align) == 0), "Structure must be strictly aligned") + /* hints for branch prediction, only use in code that runs a _lot_ where */ #ifdef __GNUC__ # define LIKELY(x) __builtin_expect(!!(x), 1) |