diff --git a/include/toolchain/common.h b/include/toolchain/common.h index 6b6df0f8d92..3da468286a3 100644 --- a/include/toolchain/common.h +++ b/include/toolchain/common.h @@ -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