summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_clang.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nxt_clang.h')
-rw-r--r--src/nxt_clang.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nxt_clang.h b/src/nxt_clang.h
index 31bc6fda..82979c6a 100644
--- a/src/nxt_clang.h
+++ b/src/nxt_clang.h
@@ -207,6 +207,12 @@ nxt_bswap32(val) \
| ((val) << 24))
+#define nxt_is_power_of_two(value) \
+ ((((value) - 1) & (value)) == 0)
+
+#define nxt_lg2(value) \
+ (31 - __builtin_clz(value))
+
#define \
nxt_align_size(d, a) \