Skip to content

Commit

Permalink
Mark scaleLinear as constexpr
Browse files Browse the repository at this point in the history
  • Loading branch information
DanRStevens committed Mar 5, 2025
1 parent 0a7c6ce commit 1c7665b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion NAS2D/Math/MathUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace NAS2D
* InputType and OutputType must support all arithmetic operators and all arithmetic operators between each other.
*/
template <typename InputType, typename OutputType>
OutputType scaleLinear(const InputType& value, const InputType& domainPoint1, const InputType& domainPoint2, const OutputType& rangePoint1, const OutputType& rangePoint2)
constexpr OutputType scaleLinear(const InputType& value, const InputType& domainPoint1, const InputType& domainPoint2, const OutputType& rangePoint1, const OutputType& rangePoint2)
{
return (value - domainPoint1) * (rangePoint2 - rangePoint1) / (domainPoint2 - domainPoint1) + rangePoint1;
}
Expand Down

0 comments on commit 1c7665b

Please sign in to comment.