summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2014-08-19 00:05:07 +0200
committerLioncash <mathew1800@gmail.com>2014-08-19 09:37:38 +0200
commit2f571a0d9d90af44cb72a273498d3c95975d75cd (patch)
treebc4b8a1355cc9f5e16310fb833a9bf7de12ac66a /src/common
parentMerge pull request #57 from lioncash/str (diff)
downloadyuzu-2f571a0d9d90af44cb72a273498d3c95975d75cd.tar
yuzu-2f571a0d9d90af44cb72a273498d3c95975d75cd.tar.gz
yuzu-2f571a0d9d90af44cb72a273498d3c95975d75cd.tar.bz2
yuzu-2f571a0d9d90af44cb72a273498d3c95975d75cd.tar.lz
yuzu-2f571a0d9d90af44cb72a273498d3c95975d75cd.tar.xz
yuzu-2f571a0d9d90af44cb72a273498d3c95975d75cd.tar.zst
yuzu-2f571a0d9d90af44cb72a273498d3c95975d75cd.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/math_util.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common/math_util.h b/src/common/math_util.h
index 65220fbdf..b32e7bb14 100644
--- a/src/common/math_util.h
+++ b/src/common/math_util.h
@@ -6,11 +6,18 @@
#include "common/common.h"
+#include <algorithm>
#include <vector>
namespace MathUtil
{
+template<typename T>
+inline T Clamp(const T val, const T& min, const T& max)
+{
+ return std::max(min, std::min(max, val));
+}
+
static const u64 DOUBLE_SIGN = 0x8000000000000000ULL,
DOUBLE_EXP = 0x7FF0000000000000ULL,
DOUBLE_FRAC = 0x000FFFFFFFFFFFFFULL,