summaryrefslogtreecommitdiff
path: root/include/rtdef.h
diff options
context:
space:
mode:
authorwdfk-prog <[email protected]>2023-06-11 23:04:18 +0800
committerMan, Jianting (Meco) <[email protected]>2023-06-11 11:41:50 -0400
commit780806feb42261142476dc8c0027252e33f4680c (patch)
tree134d5e30dd504bcb4aaeacd7eaa5934a1b30f99f /include/rtdef.h
parente36b97ff946766bdca362d1bb2f1c64402f1d937 (diff)
[rtdef] RT_IS_ALIGN marco add a null address exclusive
Diffstat (limited to 'include/rtdef.h')
-rw-r--r--include/rtdef.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/rtdef.h b/include/rtdef.h
index eb5f047f1b..1f0610cbcd 100644
--- a/include/rtdef.h
+++ b/include/rtdef.h
@@ -393,8 +393,9 @@ typedef int (*init_fn_t)(void);
* 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.
+ * @note If the address is NULL, false(0) will be returned
*/
-#define RT_IS_ALIGN(addr, align) (!(addr & (align - 1)))
+#define RT_IS_ALIGN(addr, align) ((!(addr & (align - 1))) && (addr != RT_NULL))
/**
* @ingroup BasicDef