Skip to content

Commit 55539ae

Browse files
d-a-vdevyte
authored andcommitted
fix _min and _max macros (#6374)
1 parent def8586 commit 55539ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/esp8266/Arduino.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ using std::max;
251251
using std::isinf;
252252
using std::isnan;
253253

254-
#define _min(a,b) ((a)<(b)?(a):(b))
255-
#define _max(a,b) ((a)>(b)?(a):(b))
254+
#define _min(a,b) ({ decltype(a) _a = (a); decltype(b) _b = (b); _a < _b? _a : _b; })
255+
#define _max(a,b) ({ decltype(a) _a = (a); decltype(b) _b = (b); _a > _b? _a : _b; })
256256

257257
uint16_t makeWord(uint16_t w);
258258
uint16_t makeWord(byte h, byte l);

0 commit comments

Comments
 (0)