summaryrefslogtreecommitdiffhomepage
path: root/compat/math.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-06-22 12:54:47 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-06-26 23:01:53 +0200
commitf50ac3549d6a7f1199fa012e4b03f581bc8d305b (patch)
tree50ff044f1c618119c88544709808f533ed02225e /compat/math.hpp
parentd61eb905ae3fa161d50821d01ee47915713e89c2 (diff)
core, modules: modernize syntax only
Use more C++17 features where this helps any.
Diffstat (limited to 'compat/math.hpp')
-rw-r--r--compat/math.hpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/compat/math.hpp b/compat/math.hpp
index 5d80dace..014604e6 100644
--- a/compat/math.hpp
+++ b/compat/math.hpp
@@ -54,15 +54,15 @@ inline auto clamp(const t& val, const u& min, const w& max)
}
template<typename t>
-inline int iround(const t& val)
+inline auto iround(t val) -> std::enable_if_t<!std::is_integral_v<std::decay_t<t>>, t>
{
- return int(std::round(val));
+ return (int) std::round(val);
}
template<typename t>
-inline unsigned uround(const t& val)
+inline auto uround(const t& val) -> std::enable_if_t<!std::is_integral_v<std::decay_t<t>>, t>
{
- return std::round(std::fmax(t(0), val));
+ return (unsigned) std::fmax(0, std::round(val));
}
#include "macros.hpp"