aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/util.h14
1 files changed, 3 insertions, 11 deletions
diff --git a/common/util.h b/common/util.h
index 444ee12832..f4a9a873e7 100644
--- a/common/util.h
+++ b/common/util.h
@@ -23,17 +23,9 @@
#include "scummsys.h"
-#ifndef ABS
-#define ABS(x) ((x) >= 0 ? (x) : -(x))
-#endif
-
-#ifndef MIN
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-
-#ifndef MAX
-#define MAX(a,b) (((a) > (b)) ? (a) : (b))
-#endif
+template<typename T> inline T ABS (T x) { return (x>=0) ? x : -x; }
+template<typename T> inline T MIN (T a, T b) { return (a<b) ? a : b; }
+template<typename T> inline T MAX (T a, T b) { return (a>b) ? a : b; }
/**
* Template method which swaps the vaulues of its two parameters.