mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-11 17:13:56 -03:00
AP_Common: define the ARRAY_SUBSCRIPT macro
This commit is contained in:
parent
480cbcd87c
commit
5154369e9d
@ -44,6 +44,18 @@
|
||||
#define ToRad(x) radians(x) // *pi/180
|
||||
#define ToDeg(x) degrees(x) // *180/pi
|
||||
|
||||
/* Declare and implement const and non-const versions of the array subscript
|
||||
* operator. The object is treated as an array of type_ values. */
|
||||
#define ARRAY_SUBSCRIPT(type_) \
|
||||
inline type_ &operator[](size_t i) \
|
||||
{ \
|
||||
return reinterpret_cast<type_ *>(this)[i]; \
|
||||
} \
|
||||
inline type_ operator[](size_t i) const \
|
||||
{ \
|
||||
return reinterpret_cast<const type_ *>(this)[i]; \
|
||||
}
|
||||
|
||||
#define LOCATION_ALT_MAX_M 83000 // maximum altitude (in meters) that can be fit into Location structure's alt field
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user