From ec23a3d13cf150820c1f4f6cf0caf3141f3b0351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 17 Jan 2013 00:43:50 +0100 Subject: [PATCH] Minor code cleanup. --- src/Math/Functions.h | 1 - src/Math/MathTypeTraits.h | 40 +++++++++++++++++++-------------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/Math/Functions.h b/src/Math/Functions.h index 3f26865e3..c22d70c10 100644 --- a/src/Math/Functions.h +++ b/src/Math/Functions.h @@ -18,7 +18,6 @@ #include #include #include -#include #include "Math/Vector.h" diff --git a/src/Math/MathTypeTraits.h b/src/Math/MathTypeTraits.h index 4ef7c2a4d..29ca45e00 100644 --- a/src/Math/MathTypeTraits.h +++ b/src/Math/MathTypeTraits.h @@ -100,26 +100,18 @@ template struct MathTypeTraits { */ #ifndef DOXYGEN_GENERATING_OUTPUT -namespace Implementation { - -template struct MathTypeTraitsIntegral { - MathTypeTraitsIntegral() = delete; - inline constexpr static T epsilon() { return 1; } - - inline constexpr static bool equals(T a, T b) { - return a == b; - } -}; - -template struct MathTypeTraitsFloatingPoint { - MathTypeTraitsFloatingPoint() = delete; +/* Integral scalar types */ +namespace Implementation { + template struct MathTypeTraitsIntegral { + MathTypeTraitsIntegral() = delete; - inline static bool equals(T a, T b) { - return std::abs(a - b) < MathTypeTraits::epsilon(); - } -}; + inline constexpr static T epsilon() { return 1; } + inline constexpr static bool equals(T a, T b) { + return a == b; + } + }; } template<> struct MathTypeTraits: Implementation::MathTypeTraitsIntegral { @@ -128,21 +120,18 @@ template<> struct MathTypeTraits: Implementation::MathTypeTraitsIn template<> struct MathTypeTraits: Implementation::MathTypeTraitsIntegral { typedef float FloatingPointType; }; - template<> struct MathTypeTraits: Implementation::MathTypeTraitsIntegral { typedef float FloatingPointType; }; template<> struct MathTypeTraits: Implementation::MathTypeTraitsIntegral { typedef float FloatingPointType; }; - template<> struct MathTypeTraits: Implementation::MathTypeTraitsIntegral { typedef double FloatingPointType; }; template<> struct MathTypeTraits: Implementation::MathTypeTraitsIntegral { typedef double FloatingPointType; }; - template<> struct MathTypeTraits: Implementation::MathTypeTraitsIntegral { typedef long double FloatingPointType; }; @@ -150,6 +139,17 @@ template<> struct MathTypeTraits: Implementation::MathTypeTraitsIn typedef long double FloatingPointType; }; +/* Floating-point scalar types */ +namespace Implementation { + template struct MathTypeTraitsFloatingPoint { + MathTypeTraitsFloatingPoint() = delete; + + inline static bool equals(T a, T b) { + return std::abs(a - b) < MathTypeTraits::epsilon(); + } + }; +} + template<> struct MathTypeTraits: Implementation::MathTypeTraitsFloatingPoint { typedef float FloatingPointType;