summaryrefslogtreecommitdiff
path: root/include/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/util.h')
-rw-r--r--include/util.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/util.h b/include/util.h
index e952123e37..c012470a47 100644
--- a/include/util.h
+++ b/include/util.h
@@ -56,6 +56,9 @@
#define NULL ((void *)0)
#endif
+/* True of x is a power of two */
+#define POWER_OF_TWO(x) (x && !(x & (x - 1)))
+
/**
* macros for integer division with various rounding variants
* default integer division rounds down.