diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-07-12 15:55:47 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-07-12 15:57:28 +0300 |
commit | 564e46452db09d603e3c0168fbaa008a5202d431 (patch) | |
tree | 34094c6e14fc927cc225a89fd2839e6c28df2186 /py | |
parent | 58c9586c343870e721512975af55cf210b45f756 (diff) | |
download | micropython-564e46452db09d603e3c0168fbaa008a5202d431.tar.gz micropython-564e46452db09d603e3c0168fbaa008a5202d431.zip |
py: Add generic helper to align a pointer.
Diffstat (limited to 'py')
-rw-r--r-- | py/misc.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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 |