From 2ebf959ec02048c15323e1bbfc63faedcf5067b6 Mon Sep 17 00:00:00 2001 From: navewindre Date: Fri, 12 Jul 2024 00:55:39 +0200 Subject: ha haaa --- src/mathutil.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/mathutil.h (limited to 'src/mathutil.h') 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 -- cgit v1.2.3