tools/thermal: tmon: add min/max macros
authorBrian Norris <computersforpeace@gmail.com>
Wed, 18 Feb 2015 02:18:30 +0000 (18:18 -0800)
committerZhang Rui <rui.zhang@intel.com>
Sat, 28 Feb 2015 05:52:47 +0000 (13:52 +0800)
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
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;