summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
Diffstat (limited to 'math.c')
-rw-r--r--math.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/math.c b/math.c
index c7ac64b..80ef10e 100644
--- a/math.c
+++ b/math.c
@@ -147,6 +147,11 @@ static inline i64 mod_i64(i64 a, i64 b) {
if (ret < 0) ret += b;
return ret;
}
+static inline i32 mod_i32(i32 a, i32 b) {
+ i32 ret = a % b;
+ if (ret < 0) ret += b;
+ return ret;
+}
static inline i64 abs_i64(i64 x) {
return x < 0 ? -x : +x;