summaryrefslogtreecommitdiff
path: root/py/misc.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-05-18 13:10:31 +1000
committerDamien George <damien.p.george@gmail.com>2018-05-18 23:31:00 +1000
commit43d08d6dd6fab6c88eeb20663ab97d622c2ea915 (patch)
treef9def3e6cde8054b71fe1c8b33d8ba09a5ed0d12 /py/misc.h
parent769e37b64619cf1dcf8a865d39b1341afaddbd2a (diff)
py/misc.h: Add MP_STATIC_ASSERT macro to do static assertions.
Diffstat (limited to 'py/misc.h')
-rw-r--r--py/misc.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/py/misc.h b/py/misc.h
index 72560da1e..e6d25b850 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -50,6 +50,9 @@ typedef unsigned int uint;
#define _MP_STRINGIFY(x) #x
#define MP_STRINGIFY(x) _MP_STRINGIFY(x)
+// Static assertion macro
+#define MP_STATIC_ASSERT(cond) ((void)sizeof(char[1 - 2 * !(cond)]))
+
/** memory allocation ******************************************/
// TODO make a lazy m_renew that can increase by a smaller amount than requested (but by at least 1 more element)