ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/util.h
(Generate patch)

Comparing deliantra/server/include/util.h (file contents):
Revision 1.79 by root, Fri Dec 19 22:47:29 2008 UTC vs.
Revision 1.80 by root, Tue Dec 23 01:51:28 2008 UTC

96// as a is often a constant while b is the variable. it is still a bug, though. 96// as a is often a constant while b is the variable. it is still a bug, though.
97template<typename T, typename U> static inline T min (T a, U b) { return (U)a < b ? (U)a : b; } 97template<typename T, typename U> static inline T min (T a, U b) { return (U)a < b ? (U)a : b; }
98template<typename T, typename U> static inline T max (T a, U b) { return (U)a > b ? (U)a : b; } 98template<typename T, typename U> static inline T max (T a, U b) { return (U)a > b ? (U)a : b; }
99template<typename T, typename U, typename V> static inline T clamp (T v, U a, V b) { return v < (T)a ? (T)a : v >(T)b ? (T)b : v; } 99template<typename T, typename U, typename V> static inline T clamp (T v, U a, V b) { return v < (T)a ? (T)a : v >(T)b ? (T)b : v; }
100 100
101template<typename T> static inline void min_it (T &v, T m) { v = min (v, m); } 101template<typename T, typename U> static inline void min_it (T &v, U m) { v = min (v, (T)m); }
102template<typename T> static inline void max_it (T &v, T m) { v = max (v, m); } 102template<typename T, typename U> static inline void max_it (T &v, U m) { v = max (v, (T)m); }
103template<typename T> static inline void clamp_it (T &v, T a, T b) { v = clamp (v, a, b); } 103template<typename T, typename U, typename V> static inline void clamp_it (T &v, U a, V b) { v = clamp (v, (T)a, (T)b); }
104 104
105template<typename T, typename U> static inline void swap (T& a, U& b) { T t=a; a=(T)b; b=(U)t; } 105template<typename T, typename U> static inline void swap (T& a, U& b) { T t=a; a=(T)b; b=(U)t; }
106 106
107template<typename T, typename U, typename V> static inline T min (T a, U b, V c) { return min (a, min (b, c)); } 107template<typename T, typename U, typename V> static inline T min (T a, U b, V c) { return min (a, min (b, c)); }
108template<typename T, typename U, typename V> static inline T max (T a, U b, V c) { return max (a, max (b, c)); } 108template<typename T, typename U, typename V> static inline T max (T a, U b, V c) { return max (a, max (b, c)); }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines