MultiTech / MTS-Utils

Dependents:   mtsas mtsas thermostat_fan_demo--fan mtsas ... more

NOTE: MTS-Utils has moved to GitHub. This version will not be updated. For updates, go to the GitHub version.

Files at this revision

API Documentation at this revision

Comitter:
Mike Fiore
Date:
Fri Jan 23 16:53:33 2015 -0600
Parent:
10:d1a3f03f093f
Child:
12:7818d55b35c6
Commit message:
define mts_min/mts_max inline functions instead of MIN/MAX macros - macros break in IAR

Changed in this revision

Utils.h Show annotated file Show diff for this revision Revisions of this file
--- a/Utils.h	Wed Jul 16 14:24:00 2014 +0000
+++ b/Utils.h	Fri Jan 23 16:53:33 2015 -0600
@@ -4,14 +4,10 @@
 #include <string>
 
 //Defines a max function that can be used.
-#ifndef MAX
-#define MAX(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; })
-#endif
+inline int mts_max(int a, int b) { return a > b ? a : b; }
 
 //Defines a min function that can be used.
-#ifndef MIN
-#define MIN(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
-#endif
+inline int mts_min(int a, int b) { return a < b ? a : b; }
 
 ///An enumeration for relational operators
 enum RelationalOperator {