You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#ifndef UTIL_FUNC_H
|
|
#define UTIL_FUNC_H
|
|
|
|
template<class X, class M>
|
|
inline X clamp(X x, M min, M max)
|
|
{
|
|
if (x < min)
|
|
{
|
|
return min;
|
|
}
|
|
else if (x > max)
|
|
{
|
|
return max;
|
|
}
|
|
else
|
|
{
|
|
return x;
|
|
}
|
|
}
|
|
|
|
#endif |