aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'libmaple/util.h')
-rw-r--r--libmaple/util.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/libmaple/util.h b/libmaple/util.h
index a18fa84..5b20088 100644
--- a/libmaple/util.h
+++ b/libmaple/util.h
@@ -65,6 +65,8 @@
#define __read(reg) *(volatile uint32*)(reg)
#define __write(reg, value) *(volatile uint32*)(reg) = (value)
+#define IS_POWER_OF_TWO(v) (v && !(v & (v - 1)))
+
#ifdef __cplusplus
extern "C"{
#endif