Add CHECK_SIZEOF;

It can be used to check the size of a type at compile time.
This commit is contained in:
bjorn 2018-12-09 23:36:02 -08:00
parent 7f333ce956
commit 24ba340929
1 changed files with 2 additions and 1 deletions

View File

@ -5,13 +5,14 @@
#pragma once
#define CHECK_SIZEOF(T) int(*_o)[sizeof(T)]=1
#define lovrAssert(c, ...) if (!(c)) { lovrThrow(__VA_ARGS__); }
#define lovrAlloc(T, destructor) (T*) _lovrAlloc(#T, sizeof(T), destructor)
#define MAX(a, b) (a > b ? a : b)
#define MIN(a, b) (a < b ? a : b)
#define CLAMP(x, min, max) MAX(min, MIN(max, x))
#define ALIGN(p, n) ((uintptr_t) p & -n)
typedef struct ref {