From a4477760785102e208e2fe170040a24d20032e57 Mon Sep 17 00:00:00 2001 From: gered Date: Sun, 2 Feb 2025 15:42:26 -0500 Subject: [PATCH] fix ceil_div_short the existing implementation causes issues for some reason, at least on my F256K anyway? --- src/utilities.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utilities.c b/src/utilities.c index f1b7fb7..1e22422 100644 --- a/src/utilities.c +++ b/src/utilities.c @@ -15,7 +15,11 @@ * @return the smallest short c such that c >= a / b */ short ceil_div_short(short a, short b) { - return (a + (b - 1)) / b; + if (a % b) { + return (a / b) + 1; + } else { + return a / b; + } } /**