summaryrefslogtreecommitdiff
path: root/src/utils/mathutils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/mathutils.h')
-rw-r--r--src/utils/mathutils.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utils/mathutils.h b/src/utils/mathutils.h
index 7e43a3574..60f96729d 100644
--- a/src/utils/mathutils.h
+++ b/src/utils/mathutils.h
@@ -119,4 +119,12 @@ inline int roundDouble(const double v)
return (v > 0.0) ? (v + 0.5) : (v - 0.5);
}
+inline int powerOfTwo(int input)
+{
+ int value = 1;
+ while (value < input)
+ value <<= 1;
+ return value;
+}
+
#endif // UTILS_MATHUTILS_H