summaryrefslogtreecommitdiff
path: root/src/mathutil.h
blob: d1672ecc268296e7ea676fbd2534cf1549b07093 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
}