about summary refs log tree commit diff
path: root/src/base/math.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/math.hpp')
-rw-r--r--src/base/math.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/base/math.hpp b/src/base/math.hpp
index 5e3f7ede..302935d7 100644
--- a/src/base/math.hpp
+++ b/src/base/math.hpp
@@ -19,6 +19,13 @@ inline float sign(float f)
 	return f<0.0f?-1.0f:1.0f;
 }
 
+inline int round(float f)
+{
+	if(f > 0)
+		return (int)(f+0.5f);
+	return (int)(f-0.5f);
+}
+
 template<typename T, typename TB>
 inline T mix(const T a, const T b, TB amount)
 {