[Scummvm-cvs-logs] CVS: scummvm/common util.h,1.18,1.19

Bertrand Augereau tramboi at users.sourceforge.net
Wed Jun 4 20:29:07 CEST 2003


Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv26267

Modified Files:
	util.h 
Log Message:
unmacro-ed and templated ABS, MIN & MAX

Index: util.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/util.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- util.h	29 May 2003 11:40:48 -0000	1.18
+++ util.h	5 Jun 2003 03:28:35 -0000	1.19
@@ -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.





More information about the Scummvm-git-logs mailing list