diff options
| author | navewindre <nw@moneybot.cc> | 2024-07-12 00:55:39 +0200 |
|---|---|---|
| committer | navewindre <nw@moneybot.cc> | 2024-07-12 00:55:39 +0200 |
| commit | 2ebf959ec02048c15323e1bbfc63faedcf5067b6 (patch) | |
| tree | 18862ba5d3b4be44294c0a81317d31eace7ee150 /src/mathutil.h | |
| parent | ecca2728f1a583ea484f8bdcda390a30e4906f1d (diff) | |
ha haaa
Diffstat (limited to 'src/mathutil.h')
| -rw-r--r-- | src/mathutil.h | 21 |
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 |
