summaryrefslogtreecommitdiff
path: root/src/core/math_func.hpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-12-25 09:48:53 +0000
committerrubidium <rubidium@openttd.org>2007-12-25 09:48:53 +0000
commit00c9d3ef20c83df43118a9ace5b8dd8eca26a126 (patch)
tree7d96120bc1feabf7069c9cd673a8da769e8f90fd /src/core/math_func.hpp
parent15c1af051752e2a44b0eacea419e72f6a897b491 (diff)
downloadopenttd-00c9d3ef20c83df43118a9ace5b8dd8eca26a126.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.hpp12
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 */