mirror of
https://github.com/NepEgor/OpenTrackpadController.git
synced 2024-11-15 18:12:46 +00:00
21 lines
275 B
C++
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 |