summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-25 17:07:09 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-25 17:07:09 -0500
commita56f549a266e14cdc00a98e8dc3e154f5ac6c23e (patch)
treeb513d9bbf656fe1ac054e3201fe10ac94de461ef /math.c
parentf6d49d377ac136fc29457b3b4501f0488b6412e3 (diff)
error box; generally better error handling
Diffstat (limited to 'math.c')
-rw-r--r--math.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/math.c b/math.c
index af89421..9d72aa2 100644
--- a/math.c
+++ b/math.c
@@ -46,7 +46,7 @@ static int clampi(int x, int a, int b) {
return x;
}
-static i32 clampi32(i32 x, i32 a, i32 b) {
+static i32 clamp_i32(i32 x, i32 a, i32 b) {
if (x < a) return a;
if (x > b) return b;
return x;
@@ -74,11 +74,35 @@ static double mind(double a, double b) {
return a < b ? a : b;
}
-static u32 minu32(u32 a, u32 b) {
+static u32 min_u32(u32 a, u32 b) {
return a < b ? a : b;
}
-static u32 maxu32(u32 a, u32 b) {
+static u32 max_u32(u32 a, u32 b) {
+ return a > b ? a : b;
+}
+
+static i32 min_i32(i32 a, i32 b) {
+ return a < b ? a : b;
+}
+
+static i32 max_i32(i32 a, i32 b) {
+ return a > b ? a : b;
+}
+
+static u64 min_u64(u64 a, u64 b) {
+ return a < b ? a : b;
+}
+
+static u64 max_u64(u64 a, u64 b) {
+ return a > b ? a : b;
+}
+
+static i64 min_i64(i64 a, i64 b) {
+ return a < b ? a : b;
+}
+
+static i64 max_i64(i64 a, i64 b) {
return a > b ? a : b;
}