mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 12:42:34 +01:00
bx::saturateCast requries values to be integer or float. (#356)
This commit is contained in:
committed by
GitHub
parent
f4a30a69a1
commit
a9f99c627e
@@ -172,6 +172,8 @@ namespace bx
|
||||
}
|
||||
|
||||
template<typename Ty, typename FromT>
|
||||
requires (isInteger< Ty>() || isFloatingPoint< Ty>() )
|
||||
&& (isInteger<FromT>() || isFloatingPoint<FromT>() )
|
||||
inline constexpr Ty saturateCast(const FromT& _from)
|
||||
{
|
||||
if constexpr (isSame<Ty, FromT>() )
|
||||
@@ -225,7 +227,7 @@ namespace bx
|
||||
return true;
|
||||
}
|
||||
|
||||
*_out = saturateCast<Ty>(_from);
|
||||
*_out = static_cast<Ty>(_from);
|
||||
return static_cast<FromT>(*_out) == _from;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user