summaryrefslogtreecommitdiff
path: root/maths.h
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-06-01 12:19:16 +1000
committerquou <quou@disroot.org>2024-06-01 12:20:17 +1000
commitea7cd94f7aeb177618db3907a6c86b7252e018f0 (patch)
treee972f9cf590ef756c2e41f3eac5b03e16db08300 /maths.h
Initial commit.
Diffstat (limited to 'maths.h')
-rw-r--r--maths.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/maths.h b/maths.h
new file mode 100644
index 0000000..b446c9a
--- /dev/null
+++ b/maths.h
@@ -0,0 +1,9 @@
+#ifndef maths_h
+#define maths_h
+
+#define mini(a_, b_) ((a_) < (b_) ? (a_) : (b_))
+#define maxi(a_, b_) ((a_) > (b_) ? (a_) : (b_))
+#define sign(n_) ((n_ < 0) ? -1 : 1)
+#define clamp(v_, min_, max_) (maxi(min_, mini(max_, v_)))
+
+#endif