Parcourir la source

bx::saturateCast requries values to be integer or float. (#356)

Branimir Karadžić il y a 1 mois
Parent
commit
a9f99c627e
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      include/bx/inline/bx.inl

+ 3 - 1
include/bx/inline/bx.inl

@@ -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;
 	}