AP_Common: simplify ARRAY_SUBSCRIPT macro

Add DEFINE prefix, since this macro is defining these operators and
remove the parameter since we will always use it to access a
union/struct as a byte array.
This commit is contained in:
Lucas De Marchi 2016-06-23 19:56:17 -03:00
parent 5154369e9d
commit 1962acad49
1 changed files with 3 additions and 9 deletions

View File

@ -46,15 +46,9 @@
/* 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 DEFINE_BYTE_ARRAY_METHODS \
inline uint8_t &operator[](size_t i) { return reinterpret_cast<uint8_t *>(this)[i]; } \
inline uint8_t operator[](size_t i) const { return reinterpret_cast<const uint8_t *>(this)[i]; }
#define LOCATION_ALT_MAX_M 83000 // maximum altitude (in meters) that can be fit into Location structure's alt field