summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-28 16:22:49 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-28 16:22:49 -0500
commit238f3ecc526600d5c18fead7820469719027b07c (patch)
treed84cd6606be4a81e32f8f0634aeb924b0457e5f8 /math.c
parent5b90057859cd38b284573460460ab27bd108aa0e (diff)
got file selector to behave better
Diffstat (limited to 'math.c')
-rw-r--r--math.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/math.c b/math.c
index fe28ef1..71afabc 100644
--- a/math.c
+++ b/math.c
@@ -112,6 +112,16 @@ static i64 mod_i64(i64 a, i64 b) {
return ret;
}
+static i64 abs_i64(i64 x) {
+ return x < 0 ? -x : +x;
+}
+
+static i64 sgn_i64(i64 x) {
+ if (x < 0) return -1;
+ if (x > 0) return +1;
+ return 0;
+}
+
static float sgnf(float x) {
if (x < 0) return -1;
if (x > 0) return +1;