summaryrefslogtreecommitdiff
path: root/src/mathutil.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mathutil.h')
-rw-r--r--src/mathutil.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mathutil.h b/src/mathutil.h
new file mode 100644
index 0000000..d1672ec
--- /dev/null
+++ b/src/mathutil.h
@@ -0,0 +1,21 @@
+//|_ _ _. _ ._ |_ _. _ |
+//| | (/_ (_| \/ (/_ | | | | (_| (_ |<
+
+#pragma once
+#include "typedef.h"
+
+
+template < typename t >
+inline t u_clamp( t in, const t& min, const t& max ) {
+ return in < min ? min : in > max ? max : in;
+}
+
+template < typename t >
+inline t u_max( const t& t1, const t& t2 ) {
+ return t1 > t2 ? t1 : t2;
+}
+
+template < typename t >
+inline t u_min( const t& t1, const t& t2 ) {
+ return t1 > t2 ? t2 : t1;
+} \ No newline at end of file