summaryrefslogtreecommitdiffstatshomepage
path: root/py/misc.h
diff options
context:
space:
mode:
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 c8ccdaa02e..94a3ffaaf8 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -84,6 +84,9 @@ int m_get_peak_bytes_allocated(void);
// get the number of elements in a fixed-size array
#define MP_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+// align ptr to the nearest multiple of "alignment"
+#define MP_ALIGN(ptr, alignment) (void*)(((mp_uint_t)(ptr) + ((alignment) - 1)) & ~((alignment) - 1))
+
/** unichar / UTF-8 *********************************************/
typedef int unichar; // TODO