mirror of
https://github.com/DrBeef/Raze.git
synced 2024-12-15 07:01:21 +00:00
19 lines
401 B
C
19 lines
401 B
C
|
|
||
|
#pragma once
|
||
|
|
||
|
// we do not want C++17 just for this one function...
|
||
|
|
||
|
//==========================================================================
|
||
|
//
|
||
|
// clamp
|
||
|
//
|
||
|
// Clamps in to the range [min,max].
|
||
|
//==========================================================================
|
||
|
|
||
|
template<class T>
|
||
|
inline
|
||
|
T clamp (const T in, const T min, const T max)
|
||
|
{
|
||
|
return in <= min ? min : in >= max ? max : in;
|
||
|
}
|