summaryrefslogtreecommitdiffstats
path: root/src/Defines.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Defines.h')
-rw-r--r--src/Defines.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Defines.h b/src/Defines.h
index 2f46e079c..fd0d595ae 100644
--- a/src/Defines.h
+++ b/src/Defines.h
@@ -489,7 +489,8 @@ inline void VectorToEuler(double a_X, double a_Y, double a_Z, double & a_Pan, do
-template <class T> inline T Diff(T a_Val1, T a_Val2)
+template <class T, typename = std::enable_if_t<!std::is_integral_v<T>>>
+inline T Diff(T a_Val1, T a_Val2)
{
return std::abs(a_Val1 - a_Val2);
}
@@ -498,6 +499,16 @@ template <class T> inline T Diff(T a_Val1, T a_Val2)
+template <class T, typename = std::enable_if_t<std::is_integral_v<T>>>
+inline auto Diff(T a_Val1, T a_Val2)
+{
+ return static_cast<std::make_unsigned_t<T>>(std::abs(a_Val1 - a_Val2));
+}
+
+
+
+
+
// tolua_begin
/** Normalizes an angle in degrees to the [-180, +180) range: */