From 9e9ffe65f1489d0ce8ae65839ba32a5a0b24400e Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 29 May 2016 15:28:54 +0200 Subject: [PATCH] Fixed build --- glm/detail/func_common.inl | 76 ++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index e505137f..e573be98 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -8,6 +8,44 @@ #include "_vectorize.hpp" #include +namespace glm +{ + // abs + template <> + GLM_FUNC_QUALIFIER int32 abs(int32 x) + { + int32 const y = x >> 31; + return (x ^ y) - y; + } + + // round +# if GLM_HAS_CXX11_STL + using ::std::round; +# else + template + GLM_FUNC_QUALIFIER genType round(genType x) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'round' only accept floating-point inputs"); + + return x < static_cast(0) ? static_cast(int(x - static_cast(0.5))) : static_cast(int(x + static_cast(0.5))); + } +# endif + + // trunc +# if GLM_HAS_CXX11_STL + using ::std::trunc; +# else + template + GLM_FUNC_QUALIFIER genType trunc(genType x) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'trunc' only accept floating-point inputs"); + + return x < static_cast(0) ? -floor(-x) : floor(x); + } +# endif + +}//namespace glm + namespace glm{ namespace detail { @@ -152,7 +190,7 @@ namespace detail { GLM_FUNC_QUALIFIER static vecType call(vecType const & x) { - return detail::functor1::call(floor, x); + return detail::functor1::call(std::floor, x); } }; @@ -161,7 +199,7 @@ namespace detail { GLM_FUNC_QUALIFIER static vecType call(vecType const & x) { - return detail::functor1::call(ceil, x); + return detail::functor1::call(std::ceil, x); } }; @@ -203,14 +241,6 @@ namespace detail }; }//namespace detail - // abs - template <> - GLM_FUNC_QUALIFIER int32 abs(int32 x) - { - int32 const y = x >> 31; - return (x ^ y) - y; - } - template GLM_FUNC_QUALIFIER genFIType abs(genFIType x) { @@ -254,19 +284,6 @@ namespace detail return detail::compute_floor::call(x); } - // trunc -# if GLM_HAS_CXX11_STL - using ::std::trunc; -# else - template - GLM_FUNC_QUALIFIER genType trunc(genType x) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'trunc' only accept floating-point inputs"); - - return x < static_cast(0) ? -floor(-x) : floor(x); - } -# endif - template class vecType> GLM_FUNC_QUALIFIER vecType trunc(vecType const & x) { @@ -274,19 +291,6 @@ namespace detail return detail::compute_trunc::call(x); } - // round -# if GLM_HAS_CXX11_STL - using ::std::round; -# else - template - GLM_FUNC_QUALIFIER genType round(genType x) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'round' only accept floating-point inputs"); - - return x < static_cast(0) ? static_cast(int(x - static_cast(0.5))) : static_cast(int(x + static_cast(0.5))); - } -# endif - template class vecType> GLM_FUNC_QUALIFIER vecType round(vecType const & x) {