From 2877f4eda3d1b0c7431039e3142ecf1a282a34b1 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Tue, 21 Aug 2018 20:40:38 +0500 Subject: Update glm to 0.9.9.0 --- external/include/glm/gtx/integer.inl | 42 ++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'external/include/glm/gtx/integer.inl') diff --git a/external/include/glm/gtx/integer.inl b/external/include/glm/gtx/integer.inl index 3a479e6..c9fcb4e 100644 --- a/external/include/glm/gtx/integer.inl +++ b/external/include/glm/gtx/integer.inl @@ -4,12 +4,13 @@ namespace glm { // pow - GLM_FUNC_QUALIFIER int pow(int x, int y) + GLM_FUNC_QUALIFIER int pow(int x, uint y) { if(y == 0) - return 1; + return x >= 0 ? 1 : -1; + int result = x; - for(int i = 1; i < y; ++i) + for(uint i = 1; i < y; ++i) result *= x; return result; } @@ -69,8 +70,8 @@ namespace detail } // factorial (!12 max, integer only) - template - GLM_FUNC_QUALIFIER genType factorial(genType const & x) + template + GLM_FUNC_QUALIFIER genType factorial(genType const& x) { genType Temp = x; genType Result; @@ -79,30 +80,30 @@ namespace detail return Result; } - template - GLM_FUNC_QUALIFIER tvec2 factorial( - tvec2 const & x) + template + GLM_FUNC_QUALIFIER vec<2, T, Q> factorial( + vec<2, T, Q> const& x) { - return tvec2( + return vec<2, T, Q>( factorial(x.x), factorial(x.y)); } - template - GLM_FUNC_QUALIFIER tvec3 factorial( - tvec3 const & x) + template + GLM_FUNC_QUALIFIER vec<3, T, Q> factorial( + vec<3, T, Q> const& x) { - return tvec3( + return vec<3, T, Q>( factorial(x.x), factorial(x.y), factorial(x.z)); } - template - GLM_FUNC_QUALIFIER tvec4 factorial( - tvec4 const & x) + template + GLM_FUNC_QUALIFIER vec<4, T, Q> factorial( + vec<4, T, Q> const& x) { - return tvec4( + return vec<4, T, Q>( factorial(x.x), factorial(x.y), factorial(x.z), @@ -111,6 +112,9 @@ namespace detail GLM_FUNC_QUALIFIER uint pow(uint x, uint y) { + if (y == 0) + return 1u; + uint result = x; for(uint i = 1; i < y; ++i) result *= x; @@ -140,7 +144,7 @@ namespace detail #if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_GCC)) - GLM_FUNC_QUALIFIER unsigned int nlz(unsigned int x) + GLM_FUNC_QUALIFIER unsigned int nlz(unsigned int x) { return 31u - findMSB(x); } @@ -148,7 +152,7 @@ namespace detail #else // Hackers Delight: http://www.hackersdelight.org/HDcode/nlz.c.txt - GLM_FUNC_QUALIFIER unsigned int nlz(unsigned int x) + GLM_FUNC_QUALIFIER unsigned int nlz(unsigned int x) { int y, m, n; -- cgit v1.2.3