tools/thermal: tmon: add min/max macros
authorBrian Norris <[email protected]>
Wed, 18 Feb 2015 02:18:30 +0000 (18:18 -0800)
committerZhang Rui <[email protected]>
Sat, 28 Feb 2015 05:52:47 +0000 (13:52 +0800)
Signed-off-by: Brian Norris <[email protected]>
Acked-by: Jacob Pan <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
Signed-off-by: Zhang Rui <[email protected]>
tools/thermal/tmon/tui.c

index 89f8ef0e15c810936737a51f49f1a87f1f2c5648..43c5aecf71daf51a833947726e290c9044de84e4 100644 (file)
 
 #include "tmon.h"
 
+#define min(x, y) ({                           \
+       typeof(x) _min1 = (x);                  \
+       typeof(y) _min2 = (y);                  \
+       (void) (&_min1 == &_min2);              \
+       _min1 < _min2 ? _min1 : _min2; })
+
+#define max(x, y) ({                           \
+       typeof(x) _max1 = (x);                  \
+       typeof(y) _max2 = (y);                  \
+       (void) (&_max1 == &_max2);              \
+       _max1 > _max2 ? _max1 : _max2; })
+
 static PANEL *data_panel;
 static PANEL *dialogue_panel;
 static PANEL *top;