From b5c01716bb823640455f917c9b3797d10176448f Mon Sep 17 00:00:00 2001 From: KLASSENTS Date: Wed, 28 May 2025 12:12:10 +0700 Subject: [PATCH] =?UTF-8?q?=D0=B2=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20=D1=84?= =?UTF-8?q?=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B9=20=D0=B4=D0=BB=D1=8F=20min?= =?UTF-8?q?=20max=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D1=83=D0=B5?= =?UTF-8?q?=D0=BC=20=D0=BC=D0=B0=D0=BA=D1=80=D0=BE=D1=81=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cores/arduino/wiring_constants.h | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/cores/arduino/wiring_constants.h b/cores/arduino/wiring_constants.h index 1231a2f..f46dc93 100644 --- a/cores/arduino/wiring_constants.h +++ b/cores/arduino/wiring_constants.h @@ -56,25 +56,23 @@ enum BitOrder #define NOT_AN_INTERRUPT -1 // Math -#ifdef __cplusplus - #include - using std::min; - using std::max; -#else // C - #include - #ifndef abs - #define abs(x) ((x)>0?(x):-(x)) - #endif // abs +#include +// undefine stdlib's abs if encountered +#ifdef abs +#undef abs +#endif +#ifndef abs + #define abs(x) ((x)>0?(x):-(x)) +#endif // abs - #ifndef min - #define min(a,b) ((a)<(b)?(a):(b)) - #endif // min +#ifndef min + #define min(a,b) ((a)<(b)?(a):(b)) +#endif // min - #ifndef max - #define max(a,b) ((a)>(b)?(a):(b)) - #endif // max +#ifndef max + #define max(a,b) ((a)>(b)?(a):(b)) +#endif // max -#endif // __cplusplus #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) #define radians(deg) ((deg)*DEG_TO_RAD) #define degrees(rad) ((rad)*RAD_TO_DEG)