[Base] saturate_signed NaN comment
This commit is contained in:
parent
3c20a83972
commit
866a29e153
|
@ -64,6 +64,10 @@ template <typename T>
|
||||||
constexpr T saturate_unsigned(T value) {
|
constexpr T saturate_unsigned(T value) {
|
||||||
return std::min(static_cast<T>(1.0f), std::max(static_cast<T>(0.0f), value));
|
return std::min(static_cast<T>(1.0f), std::max(static_cast<T>(0.0f), value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This diverges from the GPU NaN rules for signed normalized formats (NaN
|
||||||
|
// should be converted to 0, not to -1), but this expectation is not needed most
|
||||||
|
// of time, and cannot be met for free (unlike for 0...1 clamping).
|
||||||
template <typename T>
|
template <typename T>
|
||||||
constexpr T saturate_signed(T value) {
|
constexpr T saturate_signed(T value) {
|
||||||
return std::min(static_cast<T>(1.0f), std::max(static_cast<T>(-1.0f), value));
|
return std::min(static_cast<T>(1.0f), std::max(static_cast<T>(-1.0f), value));
|
||||||
|
|
Loading…
Reference in New Issue