mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
Make feedforward classes constexpr (#2103)
ArmFeedforward::Calculate() can't be made constexpr because std::cos() and thus units::math::cos() is not constexpr. Fixes #2101.
This commit is contained in:
committed by
Peter Johnson
parent
500c43fb84
commit
845aba33fe
@@ -838,9 +838,10 @@ SaturatingMultiplyAdd(T X, T Y, T A, bool *ResultOverflowed = nullptr) {
|
||||
return SaturatingAdd(A, Product, &Overflowed);
|
||||
}
|
||||
|
||||
// Typesafe implementation of the signum function. Returns -1 if negative, 1 if positive, 0 if 0.
|
||||
// Typesafe implementation of the signum function.
|
||||
// Returns -1 if negative, 1 if positive, 0 if 0.
|
||||
template <typename T>
|
||||
int sgn(T val) {
|
||||
constexpr int sgn(T val) {
|
||||
return (T(0) < val) - (val < T(0));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user