We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c8c7ab commit 1f14878Copy full SHA for 1f14878
cores/esp8266/Arduino.h
@@ -219,9 +219,9 @@ void optimistic_yield(uint32_t interval_us);
219
// undefine stdlib's definitions when encountered, provide abs that supports floating point for C code
220
#ifndef __cplusplus
221
#undef abs
222
-#define abs(x) ((x)>0?(x):-(x))
+#define abs(x) ({ __typeof__(x) _x = (x); _x > 0 ? _x : -_x; })
223
#undef round
224
-#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
+#define round(x) ({ __typeof__(x) _x = (x); _x >= 0 ? (long)(_x + 0.5) : (long)(_x - 0.5); })
225
#endif // ifndef __cplusplus
226
227
// from this point onward, we need to configure the c++ environment
0 commit comments