diff options
author | rubidium <rubidium@openttd.org> | 2007-12-25 09:48:53 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-12-25 09:48:53 +0000 |
commit | bf98e25e43c3f6efe207c3dde1732d44c34ac285 (patch) | |
tree | 7d96120bc1feabf7069c9cd673a8da769e8f90fd /src/core/math_func.hpp | |
parent | e2f79f0eb5d602b77bf72a2b4adca50f0a2056db (diff) | |
download | openttd-bf98e25e43c3f6efe207c3dde1732d44c34ac285.tar.xz |
(svn r11691) -Codechange: move+rename helpers.hpp and only include it when it is really needed.
Diffstat (limited to 'src/core/math_func.hpp')
-rw-r--r-- | src/core/math_func.hpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/math_func.hpp b/src/core/math_func.hpp index c05e7ffeb..e20dc6065 100644 --- a/src/core/math_func.hpp +++ b/src/core/math_func.hpp @@ -211,4 +211,16 @@ template<typename T> static inline bool IsInsideMM(const T x, const uint min, co return (uint)(x - min) < (max - min); } +/** + * Type safe swap operation + * @param a variable to swap with b + * @param b variable to swap with a + */ +template<typename T> void Swap(T& a, T& b) +{ + T t = a; + a = b; + b = t; +} + #endif /* MATH_FUNC_HPP */ |