LtRtProcessing: Make use of if constexpr in ClampFull()

This is a condition known at compile-time, so we can turn it into an
if-constexpr statement. We can also make use of std::clamp in this
scenario.
This commit is contained in:
Lioncash 2019-08-24 22:59:50 -04:00
parent 93045d5264
commit f8e827fcd4
1 changed files with 3 additions and 3 deletions

View File

@ -9,9 +9,9 @@
namespace boo { namespace boo {
namespace { namespace {
template <typename T> template <typename T>
T ClampFull(float in) { constexpr T ClampFull(float in) {
if (std::is_floating_point<T>()) { if constexpr (std::is_floating_point_v<T>) {
return std::min<T>(std::max<T>(in, -1.f), 1.f); return std::clamp(in, -1.f, 1.f);
} else { } else {
constexpr T MAX = std::numeric_limits<T>::max(); constexpr T MAX = std::numeric_limits<T>::max();
constexpr T MIN = std::numeric_limits<T>::min(); constexpr T MIN = std::numeric_limits<T>::min();