mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-14 07:43:34 +08:00
EnumMin, EnumMax
This commit is contained in:
@@ -175,6 +175,24 @@ To coerceOrFallback(const From& from)
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Selects smaller value
|
||||
*/
|
||||
template <long A, long B>
|
||||
struct EnumMin
|
||||
{
|
||||
enum { Result = (A < B) ? A : B };
|
||||
};
|
||||
|
||||
/**
|
||||
* Selects larger value
|
||||
*/
|
||||
template <long A, long B>
|
||||
struct EnumMax
|
||||
{
|
||||
enum { Result = (A > B) ? A : B };
|
||||
};
|
||||
|
||||
/**
|
||||
* Compile time square root for integers.
|
||||
* Useful for operations on square matrices.
|
||||
|
||||
Reference in New Issue
Block a user