#ifndef K_MATH_MATH_H #define K_MATH_MATH_H #include "../Defines.h" class Math { public: /** ensure val stays within [min:max] */ template static inline Scalar clamp(const Scalar min, const Scalar max, const Scalar val) { if (unlikely(val < min)) {return min;} if (unlikely(val > max)) {return max;} return val; } }; #endif // K_MATH_MATH_H