include: Add a macro to check pointer alignment
Add a new macro, IS_PTR_ALIGNED() that verifies if a pointer is aligned sufficiently for a particular data type provided as an argument. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
cf111962e0
commit
944a02d18a
1 changed files with 3 additions and 0 deletions
|
@ -187,6 +187,9 @@
|
|||
*/
|
||||
#define Z_DECL_ALIGN(type) __aligned(__alignof(type)) type
|
||||
|
||||
/* Check if a pointer is aligned enough for a particular data type. */
|
||||
#define IS_PTR_ALIGNED(ptr, type) ((((uintptr_t)ptr) % __alignof(type)) == 0)
|
||||
|
||||
/**
|
||||
* @brief Iterable Sections APIs
|
||||
* @defgroup iterable_section_apis Iterable Sections APIs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue