summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/misc.c8
-rw-r--r--src/core/misc.h2
2 files changed, 9 insertions, 1 deletions
diff --git a/src/core/misc.c b/src/core/misc.c
index 00f9d096..89f564d3 100644
--- a/src/core/misc.c
+++ b/src/core/misc.c
@@ -808,3 +808,11 @@ char *escape_string(const char *str)
return ret;
}
+
+int nearest_power(int num)
+{
+ int n = 1;
+
+ while (n < num) n <<= 1;
+ return n;
+}
diff --git a/src/core/misc.h b/src/core/misc.h
index 95946077..b18ad154 100644
--- a/src/core/misc.h
+++ b/src/core/misc.h
@@ -8,7 +8,7 @@
typedef void* (*FOREACH_FIND_FUNC) (void *item, void *data);
typedef int (*COLUMN_LEN_FUNC)(void *data);
-static inline int nearest_power(int num)
+extern inline int nearest_power(int num)
{
int n = 1;