From 1cfa7f05d9c57de0532d1a17faab3644e579e7f0 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 30 Oct 2016 20:04:17 -0400 Subject: [PATCH] added missing defines --- include/villas/utils.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/villas/utils.h b/include/villas/utils.h index d6faadff2..8a50b6754 100644 --- a/include/villas/utils.h +++ b/include/villas/utils.h @@ -57,6 +57,12 @@ #define CEIL(x, y) ((x + y - 1) / y) +/** Get nearest up-rounded power of 2 */ +#define LOG2_CEIL(x) (1 << (log2i((x) - 1) + 1)) + +/** Check if the number is a power of 2 */ +#define IS_POW2(x) (((x) != 0) && !((x) & ((x) - 1))) + /** Calculate the number of elements in an array. */ #define ARRAY_LEN(a) ( sizeof (a) / sizeof (a)[0] )