Skip to content

Commit 995e5b1

Browse files
authored
Fixes round()
Adds Arduino basic math Macros with '_' prefix.
1 parent 10eac92 commit 995e5b1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cores/esp32/Arduino.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@
7070
#endif
7171

7272
// can't define max() / min() because of conflicts with C++
73-
#define _min(a,b) ((a)<(b)?(a):(b))
73+
#define _min(a,b) ((a)<(b)?(a):(b))
7474
#define _max(a,b) ((a)>(b)?(a):(b))
75-
//#define abs(x) ((x)>0?(x):-(x)) // abs() comes from stdlib
75+
#define _abs(x) ((x)>0?(x):-(x)) // abs() comes from STL
7676
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
77-
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
77+
#define _round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) // round() comes from STL
7878
#define radians(deg) ((deg)*DEG_TO_RAD)
7979
#define degrees(rad) ((rad)*RAD_TO_DEG)
8080
#define sq(x) ((x)*(x))

0 commit comments

Comments
 (0)