From 0228f21e4cee7dc1544286766c8155d2ec2d761f Mon Sep 17 00:00:00 2001 From: David Gauchard Date: Thu, 1 Aug 2019 19:19:00 +0200 Subject: [PATCH] fix _min and _max macros --- cores/esp8266/Arduino.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cores/esp8266/Arduino.h b/cores/esp8266/Arduino.h index 7711e8fa58..692505afff 100644 --- a/cores/esp8266/Arduino.h +++ b/cores/esp8266/Arduino.h @@ -272,8 +272,8 @@ using std::max; using std::isinf; using std::isnan; -#define _min(a,b) ((a)<(b)?(a):(b)) -#define _max(a,b) ((a)>(b)?(a):(b)) +#define _min(a,b) ({ decltype(a) _a = (a); decltype(b) _b = (b); _a < _b? _a : _b; }) +#define _max(a,b) ({ decltype(a) _a = (a); decltype(b) _b = (b); _a > _b? _a : _b; }) uint16_t makeWord(uint16_t w); uint16_t makeWord(byte h, byte l);