opentrackpadcontroller/lib/utils/include/util_func.h
2022-05-05 20:31:55 +06:00

21 lines
275 B
C++

#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