mirror of https://github.com/AxioDL/boo.git
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:
parent
93045d5264
commit
f8e827fcd4
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue