From d1fcfe950a70ddbdd97164832cdb83ef2cc7f23a Mon Sep 17 00:00:00 2001 From: Andrew Ryabinin Date: Sat, 29 Nov 2014 20:42:22 +0300 Subject: Add IS_ALIGNED(x, a) macro helper Change-Id: Ic5799e4bc03cabddece80cbc129b16f3a19ff9c5 --- firmware/export/system.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/firmware/export/system.h b/firmware/export/system.h index 47dd858d81..e83ee53d96 100644 --- a/firmware/export/system.h +++ b/firmware/export/system.h @@ -134,6 +134,8 @@ int get_cpu_boost_counter(void); (size) = __a2 > __a1 ? __a2 - __a1 : 0; \ }) +#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) + #define PTR_ADD(ptr, x) ((typeof(ptr))((char*)(ptr) + (x))) #define PTR_SUB(ptr, x) ((typeof(ptr))((char*)(ptr) - (x))) -- cgit v1.2.3