Speedup for microcontrast, issue #3867

This commit is contained in:
heckflosse
2017-05-08 18:42:13 +02:00
parent af09d56b3b
commit 8b44ed0fd8
2 changed files with 166 additions and 253 deletions

View File

@@ -87,6 +87,13 @@ constexpr T CLIP(const T& a)
return LIM(a, static_cast<T>(0), static_cast<T>(MAXVAL));
}
template <typename T>
constexpr T SGN(const T& a)
{
// returns -1 for a < 0, 0 for a = 0 and +1 for a > 0
return (T(0) < a) - (a < T(0));
}
template<typename T>
constexpr T intp(T a, T b, T c)
{