Browse Source

tools/thermal: tmon: add min/max macros

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>
Brian Norris 10 years ago
parent
commit
a90b6b006c
1 changed files with 12 additions and 0 deletions
  1. 12 0
      tools/thermal/tmon/tui.c

+ 12 - 0
tools/thermal/tmon/tui.c

@@ -30,6 +30,18 @@
 
 
 #include "tmon.h"
 #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 *data_panel;
 static PANEL *dialogue_panel;
 static PANEL *dialogue_panel;
 static PANEL *top;
 static PANEL *top;