mirror of https://github.com/bjornbytes/lovr.git
Add CHECK_SIZEOF;
It can be used to check the size of a type at compile time.
This commit is contained in:
parent
7f333ce956
commit
24ba340929
|
@ -5,13 +5,14 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#define CHECK_SIZEOF(T) int(*_o)[sizeof(T)]=1
|
||||||
|
|
||||||
#define lovrAssert(c, ...) if (!(c)) { lovrThrow(__VA_ARGS__); }
|
#define lovrAssert(c, ...) if (!(c)) { lovrThrow(__VA_ARGS__); }
|
||||||
#define lovrAlloc(T, destructor) (T*) _lovrAlloc(#T, sizeof(T), destructor)
|
#define lovrAlloc(T, destructor) (T*) _lovrAlloc(#T, sizeof(T), destructor)
|
||||||
|
|
||||||
#define MAX(a, b) (a > b ? a : b)
|
#define MAX(a, b) (a > b ? a : b)
|
||||||
#define MIN(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 CLAMP(x, min, max) MAX(min, MIN(max, x))
|
||||||
|
|
||||||
#define ALIGN(p, n) ((uintptr_t) p & -n)
|
#define ALIGN(p, n) ((uintptr_t) p & -n)
|
||||||
|
|
||||||
typedef struct ref {
|
typedef struct ref {
|
||||||
|
|
Loading…
Reference in New Issue