вместо функций для min max используем макросы

This commit is contained in:
KLASSENTS 2025-05-28 12:12:10 +07:00
parent ae811a9847
commit b5c01716bb

View File

@ -56,12 +56,11 @@ enum BitOrder
#define NOT_AN_INTERRUPT -1 #define NOT_AN_INTERRUPT -1
// Math // Math
#ifdef __cplusplus
#include <algorithm>
using std::min;
using std::max;
#else // C
#include <stdlib.h> #include <stdlib.h>
// undefine stdlib's abs if encountered
#ifdef abs
#undef abs
#endif
#ifndef abs #ifndef abs
#define abs(x) ((x)>0?(x):-(x)) #define abs(x) ((x)>0?(x):-(x))
#endif // abs #endif // abs
@ -74,7 +73,6 @@ enum BitOrder
#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)