raze/source/core/utility/templates.h
Christoph Oelckers e2f5e8fe34 - renamed 'common' to 'core'.
We'll need 'common' for something else.
2020-04-12 08:30:36 +02:00

18 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;
}