summaryrefslogtreecommitdiffstats
path: root/src/common/ufo-math.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/ufo-math.c')
-rw-r--r--src/common/ufo-math.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/ufo-math.c b/src/common/ufo-math.c
index 78b7dda..725b7e6 100644
--- a/src/common/ufo-math.c
+++ b/src/common/ufo-math.c
@@ -140,3 +140,12 @@ ufo_array_minimum (gdouble *array, gint num_values)
{
return find_extremum (array, num_values, 1);
}
+
+gsize
+ufo_math_compute_closest_smaller_power_of_2 (gsize value)
+{
+ gdouble integer;
+ modf (log2 (value), &integer);
+
+ return (gsize) pow (2, integer);
+}