aboutsummaryrefslogtreecommitdiff
path: root/src/common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.cpp')
-rw-r--r--src/common.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common.cpp b/src/common.cpp
index 94248fb62..77caddfe8 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -47,6 +47,13 @@ void debugf(char const *fmt, ...);
#include "range_cache.cpp"
+bool is_power_of_two(i64 x) {
+ if (x <= 0) {
+ return false;
+ }
+ return !(x & (x-1));
+}
+
int isize_cmp(isize x, isize y) {
if (x < y) {
return -1;