mirror of
https://github.com/licsber/micropython.git
synced 2024-09-20 09:00:23 +08:00
py: Add generic helper to align a pointer.
This commit is contained in:
parent
58c9586c34
commit
564e46452d
@ -84,6 +84,9 @@ int m_get_peak_bytes_allocated(void);
|
|||||||
// get the number of elements in a fixed-size array
|
// get the number of elements in a fixed-size array
|
||||||
#define MP_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
#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 *********************************************/
|
/** unichar / UTF-8 *********************************************/
|
||||||
|
|
||||||
typedef int unichar; // TODO
|
typedef int unichar; // TODO
|
||||||
|
Loading…
Reference in New Issue
Block a user