aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorBertrand Augereau2003-06-05 03:28:35 +0000
committerBertrand Augereau2003-06-05 03:28:35 +0000
commit91a3d553e4aa9d31d73fa3607a659a2d33aa1a91 (patch)
treebd858fa2633ad450e4a17b1d6c753b824d29d48b /common
parent0aff2d3461396a0957bf5cc5a7ab87520e8d1b7d (diff)
downloadscummvm-rg350-91a3d553e4aa9d31d73fa3607a659a2d33aa1a91.tar.gz
scummvm-rg350-91a3d553e4aa9d31d73fa3607a659a2d33aa1a91.tar.bz2
scummvm-rg350-91a3d553e4aa9d31d73fa3607a659a2d33aa1a91.zip
unmacro-ed and templated ABS, MIN & MAX
svn-id: r8311
Diffstat (limited to 'common')
-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.