forked from Archive/PX4-Autopilot
mathlib : switch min/max to constexpr to match std::min/max
This commit is contained in:
parent
9909a373b0
commit
c8dad56300
|
@ -56,19 +56,19 @@ namespace math
|
|||
{
|
||||
|
||||
template<typename _Tp>
|
||||
inline const _Tp &min(const _Tp &a, const _Tp &b)
|
||||
inline constexpr const _Tp &min(const _Tp &a, const _Tp &b)
|
||||
{
|
||||
return (a < b) ? a : b;
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline const _Tp &max(const _Tp &a, const _Tp &b)
|
||||
inline constexpr const _Tp &max(const _Tp &a, const _Tp &b)
|
||||
{
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline const _Tp &constrain(const _Tp &val, const _Tp &min_val, const _Tp &max_val)
|
||||
inline constexpr const _Tp &constrain(const _Tp &val, const _Tp &min_val, const _Tp &max_val)
|
||||
{
|
||||
return (val < min_val) ? min_val : ((val > max_val) ? max_val : val);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue