diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-08-21 17:40:38 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-08-21 17:40:38 +0200 |
commit | 2877f4eda3d1b0c7431039e3142ecf1a282a34b1 (patch) | |
tree | 58ad35e27ab2a3b8955f5adbf28f296670681ffc /external/include/glm/gtx/integer.inl | |
parent | Smooth sun movement (diff) | |
download | AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar.gz AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar.bz2 AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar.lz AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar.xz AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar.zst AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.zip |
Diffstat (limited to 'external/include/glm/gtx/integer.inl')
-rw-r--r-- | external/include/glm/gtx/integer.inl | 42 |
1 files changed, 23 insertions, 19 deletions
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 <typename genType> - GLM_FUNC_QUALIFIER genType factorial(genType const & x) + template<typename genType> + GLM_FUNC_QUALIFIER genType factorial(genType const& x) { genType Temp = x; genType Result; @@ -79,30 +80,30 @@ namespace detail return Result; } - template <typename T, precision P> - GLM_FUNC_QUALIFIER tvec2<T, P> factorial( - tvec2<T, P> const & x) + template<typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<2, T, Q> factorial( + vec<2, T, Q> const& x) { - return tvec2<T, P>( + return vec<2, T, Q>( factorial(x.x), factorial(x.y)); } - template <typename T, precision P> - GLM_FUNC_QUALIFIER tvec3<T, P> factorial( - tvec3<T, P> const & x) + template<typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<3, T, Q> factorial( + vec<3, T, Q> const& x) { - return tvec3<T, P>( + return vec<3, T, Q>( factorial(x.x), factorial(x.y), factorial(x.z)); } - template <typename T, precision P> - GLM_FUNC_QUALIFIER tvec4<T, P> factorial( - tvec4<T, P> const & x) + template<typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<4, T, Q> factorial( + vec<4, T, Q> const& x) { - return tvec4<T, P>( + 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; |