вместо функций для min max используем макросы
This commit is contained in:
parent
ae811a9847
commit
b5c01716bb
@ -56,25 +56,23 @@ enum BitOrder
|
|||||||
#define NOT_AN_INTERRUPT -1
|
#define NOT_AN_INTERRUPT -1
|
||||||
|
|
||||||
// Math
|
// Math
|
||||||
#ifdef __cplusplus
|
#include <stdlib.h>
|
||||||
#include <algorithm>
|
// undefine stdlib's abs if encountered
|
||||||
using std::min;
|
#ifdef abs
|
||||||
using std::max;
|
#undef abs
|
||||||
#else // C
|
#endif
|
||||||
#include <stdlib.h>
|
#ifndef abs
|
||||||
#ifndef abs
|
#define abs(x) ((x)>0?(x):-(x))
|
||||||
#define abs(x) ((x)>0?(x):-(x))
|
#endif // abs
|
||||||
#endif // abs
|
|
||||||
|
|
||||||
#ifndef min
|
#ifndef min
|
||||||
#define min(a,b) ((a)<(b)?(a):(b))
|
#define min(a,b) ((a)<(b)?(a):(b))
|
||||||
#endif // min
|
#endif // min
|
||||||
|
|
||||||
#ifndef max
|
#ifndef max
|
||||||
#define max(a,b) ((a)>(b)?(a):(b))
|
#define max(a,b) ((a)>(b)?(a):(b))
|
||||||
#endif // max
|
#endif // max
|
||||||
|
|
||||||
#endif // __cplusplus
|
|
||||||
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
|
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
|
||||||
#define radians(deg) ((deg)*DEG_TO_RAD)
|
#define radians(deg) ((deg)*DEG_TO_RAD)
|
||||||
#define degrees(rad) ((rad)*RAD_TO_DEG)
|
#define degrees(rad) ((rad)*RAD_TO_DEG)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user