summaryrefslogtreecommitdiff
path: root/src/utils/mathutils.h
diff options
context:
space:
mode:
authorReid <reidyaro@gmail.com>2012-03-01 22:03:01 +0100
committerReid <reidyaro@gmail.com>2012-03-01 22:03:01 +0100
commit490862919d79369112c75955a9c36ff8a081efd3 (patch)
tree6fe89466b9c53ba811f298174e6d787bbae71e09 /src/utils/mathutils.h
parentdff814619d63496acd3c4e8730b828b5d4d931fb (diff)
parentd873da3e8e57480016596f714845c1bc7e712e68 (diff)
downloadmv-490862919d79369112c75955a9c36ff8a081efd3.tar.gz
mv-490862919d79369112c75955a9c36ff8a081efd3.tar.bz2
mv-490862919d79369112c75955a9c36ff8a081efd3.tar.xz
mv-490862919d79369112c75955a9c36ff8a081efd3.zip
Merge branch 'master' of gitorious.org:manaplus/manaplus
Diffstat (limited to 'src/utils/mathutils.h')
-rw-r--r--src/utils/mathutils.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils/mathutils.h b/src/utils/mathutils.h
index 9f6818146..6d5a8339d 100644
--- a/src/utils/mathutils.h
+++ b/src/utils/mathutils.h
@@ -23,7 +23,9 @@
#ifndef UTILS_MATHUTILS_H
#define UTILS_MATHUTILS_H
+#include <string>
#include <stdint.h>
+#include <cstring>
static uint16_t crc_table[256] =
{
@@ -112,4 +114,9 @@ inline float weightedAverage(float n1, float n2, float w)
return w * n2 + (1.0f - w) * n1;
}
+inline int roundDouble(double v)
+{
+ return (v > 0.0) ? (v + 0.5) : (v - 0.5);
+}
+
#endif // UTILS_MATHUTILS_H