aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2024-11-24 12:57:05 +0100
committerFederico Angelilli <code@fedang.net>2024-11-24 12:57:05 +0100
commitb260d5beb9fab0c39f18be677e70b35e988d3c1d (patch)
tree1654463c878f17130d52ea6c99c725d0fbacc754 /src/util.c
parent57f91ef34cb8a8a1db2c18b468165a4273f13fa8 (diff)
Scale surfaces properly
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index ca848ec..6001a31 100644
--- a/src/util.c
+++ b/src/util.c
@@ -205,6 +205,11 @@ void strfree(char **list)
free(list);
}
+double steps(double value, int n)
+{
+ return floor(value * n) * (1.0 / n);
+}
+
bool iszero(const void *ptr, size_t size)
{
for (size_t i = 0; i < size; i++) {