1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 08:15:30 +03:00

fix dangerous MIN/MAX/ABS definitions

This commit is contained in:
fishpepper 2017-08-15 21:07:14 +02:00
parent 53920103d8
commit a74979ff72

View file

@ -37,9 +37,17 @@
#define CM_S_TO_KM_H(centimetersPerSecond) (centimetersPerSecond * 36 / 1000)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define MIN(a,b) \
__extension__ ({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; })
#define MAX(a,b) \
__extension__ ({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; })
#define ABS(x) \
__extension__ ({ __typeof__ (x) _x = (x); \
_x > 0 ? _x : -_x; })
#define Q12 (1 << 12)