summaryrefslogtreecommitdiff
path: root/src/core/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/misc.c')
-rw-r--r--src/core/misc.c8
1 files changed, 8 insertions, 0 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;
+}