summaryrefslogtreecommitdiff
path: root/runtime.c
diff options
context:
space:
mode:
Diffstat (limited to 'runtime.c')
-rw-r--r--runtime.c54
1 files changed, 53 insertions, 1 deletions
diff --git a/runtime.c b/runtime.c
index bc715c5..e0e1b5b 100644
--- a/runtime.c
+++ b/runtime.c
@@ -45,7 +45,6 @@
//
// - Work in progress
// - Graphics
-// - Stencil buffer
// - Custom fonts - integrate stb_truetype.h
// - UI
// - Icons
@@ -141,6 +140,7 @@
// - Self-contained impl
// - Anti-aliasing
// - Gamma correction
+// - Stencil buffer
// - System
// - Dynamic libraries
// - Window - X11, Web
@@ -797,6 +797,22 @@ static void mem_cpy_(void *dst, void *src, i64 len) {
*d = *s;
}
+static f64 min2_(f64 x, f64 y) {
+ return x < y ? x : y;
+}
+
+static f64 max2_(f64 x, f64 y) {
+ return x > y ? x : y;
+}
+
+static u8 min2_u8_(u8 x, u8 y) {
+ return x < y ? x : y;
+}
+
+static u8 max2_u8_(u8 x, u8 y) {
+ return x > y ? x : y;
+}
+
static i32 min2_i32_(i32 x, i32 y) {
return x < y ? x : y;
}
@@ -813,6 +829,22 @@ static f32 max2_f32_(f32 a, f32 b) {
return a < b ? b : a;
}
+static f64 min3_i64_(i64 a, i64 b, i64 c) {
+ if (a < b && a < c)
+ return a;
+ if (b < c)
+ return b;
+ return c;
+}
+
+static f64 max3_i64_(i64 a, i64 b, i64 c) {
+ if (a > b && a > c)
+ return a;
+ if (b > c)
+ return b;
+ return c;
+}
+
static f64 min3_(f64 a, f64 b, f64 c) {
if (a < b && a < c)
return a;
@@ -829,6 +861,26 @@ static f64 max3_(f64 a, f64 b, f64 c) {
return c;
}
+static f64 min4_i64_(i64 a, i64 b, i64 c, i64 d) {
+ if (a < b && a < c && a < d)
+ return a;
+ if (b < c && b < d)
+ return b;
+ if (c < d)
+ return c;
+ return d;
+}
+
+static f64 max4_i64_(i64 a, i64 b, i64 c, i64 d) {
+ if (a > b && a > c && a > d)
+ return a;
+ if (b > c && b > d)
+ return b;
+ if (c > d)
+ return c;
+ return d;
+}
+
static f64 min4_(f64 a, f64 b, f64 c, f64 d) {
if (a < b && a < c && a < d)
return a;