From de1a9b4ab3b6003472adbee47173510a05075ce0 Mon Sep 17 00:00:00 2001 From: Georg Reinke Date: Tue, 28 Mar 2017 13:26:15 +0200 Subject: [PATCH] fix IS_ALIGNED macro The old macro lead to failures on the tester, even though the alignment actually was correct. --- include/villas/utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/villas/utils.h b/include/villas/utils.h index 9df8b9ba9..03e6ae686 100644 --- a/include/villas/utils.h +++ b/include/villas/utils.h @@ -51,7 +51,7 @@ #define ALIGN(x, a) ALIGN_MASK(x, (uintptr_t) (a) - 1) #define ALIGN_MASK(x, m) (((uintptr_t) (x) + (m)) & ~(m)) -#define IS_ALIGNED(x, a) (ALIGN(x, a) == (uintptr_t) x) +#define IS_ALIGNED(x, a) ((uintptr_t) (x) % (uintptr_t) (a) == 0) /** Round-up integer division */ #define CEIL(x, y) (((x) + (y) - 1) / (y)) @@ -228,4 +228,4 @@ static inline int log2i(long long x) { /** Sleep with rdtsc */ void rdtsc_sleep(uint64_t nanosecs, uint64_t start); -#endif /* _UTILS_H_ */ \ No newline at end of file +#endif /* _UTILS_H_ */