[rtdef] add RT_IS_ALIGN macro

This commit is contained in:
Meco Man 2023-06-08 17:41:57 -04:00 committed by Man, Jianting (Meco)
parent 7c3f5c3879
commit 9522ef8486
1 changed files with 10 additions and 0 deletions

View File

@ -386,6 +386,16 @@ typedef int (*init_fn_t)(void);
/**@}*/ /**@}*/
/**
* @ingroup BasicDef
*
* @def RT_IS_ALIGN(addr, align)
* Return true(1) or false(0).
* RT_IS_ALIGN(128, 4) is judging whether 128 aligns with 4.
* The result is 1, which means 128 aligns with 4.
*/
#define RT_IS_ALIGN(addr, align) (!(addr & (align - 1)))
/** /**
* @ingroup BasicDef * @ingroup BasicDef
* *