summaryrefslogtreecommitdiff
path: root/src/macros.h
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2007-01-11 11:05:01 +0000
committercelestar <celestar@openttd.org>2007-01-11 11:05:01 +0000
commit08de6b082af59087361b5d7e5be67b6e3cd66a82 (patch)
treef9cb6bcd0d0b855706d1e00e0a4ffd2757c7e039 /src/macros.h
parent067784756919b908503541cee9648840ffa04f4c (diff)
downloadopenttd-08de6b082af59087361b5d7e5be67b6e3cd66a82.tar.xz
(svn r8055) -Codechange: Replace the different max, dmax, maxu whatever macros by a simple template function max(), that requires two arguments of the same type. While I'm at it change a variable called "max" to "maxval" in a function that calls max().
Diffstat (limited to 'src/macros.h')
-rw-r--r--src/macros.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/macros.h b/src/macros.h
index 644f178af..07011f14c 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -20,13 +20,11 @@
#undef max
#endif
-static inline int max(int a, int b) { if (a >= b) return a; return b; }
-static inline double dmax(double a, double b) { if (a >= b) return a; return b; }
-static inline uint64 max64(uint64 a, uint64 b) { if (a >= b) return a; return b; }
+template <typename T> T max(T a, T b) { return a >= b ? a : b; }
+
static inline int min(int a, int b) { if (a <= b) return a; return b; }
static inline uint minu(uint a, uint b) { if (a <= b) return a; return b; }
-static inline uint maxu(uint a, uint b) { if (a >= b) return a; return b; }
static inline int clamp(int a, int min, int max)