mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-06 19:00:27 +08:00
AP_Math: added unsigned versions of constrain functions
sometimes it really does matter that we use constrain_uint32() instead of constrain_int32(). For example, if we have a value like 0xFFFFFFFF then the result will be very different we should use unsigned constrain when dealing with unsigned values
This commit is contained in:
@@ -313,9 +313,13 @@ T constrain_value(const T amt, const T low, const T high)
|
||||
}
|
||||
|
||||
template int constrain_value<int>(const int amt, const int low, const int high);
|
||||
template unsigned int constrain_value<unsigned int>(const unsigned int amt, const unsigned int low, const unsigned int high);
|
||||
template long constrain_value<long>(const long amt, const long low, const long high);
|
||||
template unsigned long constrain_value<unsigned long>(const unsigned long amt, const unsigned long low, const unsigned long high);
|
||||
template long long constrain_value<long long>(const long long amt, const long long low, const long long high);
|
||||
template unsigned long long constrain_value<unsigned long long>(const unsigned long long amt, const unsigned long long low, const unsigned long long high);
|
||||
template short constrain_value<short>(const short amt, const short low, const short high);
|
||||
template unsigned short constrain_value<unsigned short>(const unsigned short amt, const unsigned short low, const unsigned short high);
|
||||
template float constrain_value<float>(const float amt, const float low, const float high);
|
||||
template double constrain_value<double>(const double amt, const double low, const double high);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user