diff --git a/glm/core/func_integer.inl b/glm/core/func_integer.inl index 78f2ca11..370e7770 100644 --- a/glm/core/func_integer.inl +++ b/glm/core/func_integer.inl @@ -42,64 +42,56 @@ namespace glm { // uaddCarry - template - GLM_FUNC_QUALIFIER genUType uaddCarry + template <> + GLM_FUNC_QUALIFIER uint uaddCarry ( - genUType const & x, - genUType const & y, - genUType & Carry + uint const & x, + uint const & y, + uint & Carry ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer && !std::numeric_limits::is_signed, "'uaddCarry' only accept unsigned integer inputs"); - uint64 Value64 = static_cast(x) + static_cast(y); - genUType Result = genUType(Value64 % (static_cast(1) << static_cast(32))); - Carry = (Value64 % (static_cast(1) << static_cast(32))) > 1 ? static_cast(1) : static_cast(0); + uint32 Result = static_cast(Value64 % (static_cast(1) << static_cast(32))); + Carry = (Value64 % (static_cast(1) << static_cast(32))) > 1 ? static_cast(1) : static_cast(0); return Result; } - template - GLM_FUNC_QUALIFIER detail::tvec2 uaddCarry + template <> + GLM_FUNC_QUALIFIER uvec2 uaddCarry ( - detail::tvec2 const & x, - detail::tvec2 const & y, - detail::tvec2 & Carry + uvec2 const & x, + uvec2 const & y, + uvec2 & Carry ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer && !std::numeric_limits::is_signed, "'uaddCarry' only accept unsigned integer inputs"); - - return detail::tvec2( + return uvec2( uaddCarry(x[0], y[0], Carry[0]), uaddCarry(x[1], y[1], Carry[1])); } - template - GLM_FUNC_QUALIFIER detail::tvec3 uaddCarry + template <> + GLM_FUNC_QUALIFIER uvec3 uaddCarry ( - detail::tvec3 const & x, - detail::tvec3 const & y, - detail::tvec3 & Carry + uvec3 const & x, + uvec3 const & y, + uvec3 & Carry ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer && !std::numeric_limits::is_signed, "'uaddCarry' only accept unsigned integer inputs"); - - return detail::tvec3( + return uvec3( uaddCarry(x[0], y[0], Carry[0]), uaddCarry(x[1], y[1], Carry[1]), uaddCarry(x[2], y[2], Carry[2])); } - template - GLM_FUNC_QUALIFIER detail::tvec4 uaddCarry + template <> + GLM_FUNC_QUALIFIER uvec4 uaddCarry ( - detail::tvec4 const & x, - detail::tvec4 const & y, - detail::tvec4 & Carry + uvec4 const & x, + uvec4 const & y, + uvec4 & Carry ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer && !std::numeric_limits::is_signed, "'uaddCarry' only accept unsigned integer inputs"); - - return detail::tvec4( + return uvec4( uaddCarry(x[0], y[0], Carry[0]), uaddCarry(x[1], y[1], Carry[1]), uaddCarry(x[2], y[2], Carry[2]), @@ -107,65 +99,59 @@ namespace glm } // usubBorrow - template - GLM_FUNC_QUALIFIER genUType usubBorrow + template <> + GLM_FUNC_QUALIFIER uint usubBorrow ( - genUType const & x, - genUType const & y, - genUType & Borrow + uint const & x, + uint const & y, + uint & Borrow ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer && !std::numeric_limits::is_signed, "'usubBorrow' only accept unsigned integer inputs"); + GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch"); - Borrow = x >= y ? static_cast(0) : static_cast(1); + Borrow = x >= y ? static_cast(0) : static_cast(1); if(x > y) - return static_cast(static_cast(x) -static_cast(y)); + return static_cast(static_cast(x) -static_cast(y)); else - return static_cast((static_cast(1) << static_cast(32)) + static_cast(x) - static_cast(y)); + return static_cast((static_cast(1) << static_cast(32)) + static_cast(x) - static_cast(y)); } - template - GLM_FUNC_QUALIFIER detail::tvec2 usubBorrow + template <> + GLM_FUNC_QUALIFIER uvec2 usubBorrow ( - detail::tvec2 const & x, - detail::tvec2 const & y, - detail::tvec2 & Borrow + uvec2 const & x, + uvec2 const & y, + uvec2 & Borrow ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer && !std::numeric_limits::is_signed, "'usubBorrow' only accept unsigned integer inputs"); - - return detail::tvec2( + return uvec2( usubBorrow(x[0], y[0], Borrow[0]), usubBorrow(x[1], y[1], Borrow[1])); } - template - GLM_FUNC_QUALIFIER detail::tvec3 usubBorrow + template <> + GLM_FUNC_QUALIFIER uvec3 usubBorrow ( - detail::tvec3 const & x, - detail::tvec3 const & y, - detail::tvec3 & Borrow + uvec3 const & x, + uvec3 const & y, + uvec3 & Borrow ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer && !std::numeric_limits::is_signed, "'usubBorrow' only accept unsigned integer inputs"); - - return detail::tvec3( + return uvec3( usubBorrow(x[0], y[0], Borrow[0]), usubBorrow(x[1], y[1], Borrow[1]), usubBorrow(x[2], y[2], Borrow[2])); } - template - GLM_FUNC_QUALIFIER detail::tvec4 usubBorrow + template <> + GLM_FUNC_QUALIFIER uvec4 usubBorrow ( - detail::tvec4 const & x, - detail::tvec4 const & y, - detail::tvec4 & Borrow + uvec4 const & x, + uvec4 const & y, + uvec4 & Borrow ) { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer && !std::numeric_limits::is_signed, "'usubBorrow' only accept unsigned integer inputs"); - - return detail::tvec4( + return uvec4( usubBorrow(x[0], y[0], Borrow[0]), usubBorrow(x[1], y[1], Borrow[1]), usubBorrow(x[2], y[2], Borrow[2]), diff --git a/readme.txt b/readme.txt index 0d4d32a2..e2146f63 100644 --- a/readme.txt +++ b/readme.txt @@ -65,7 +65,7 @@ GLM 0.9.5.0: 2013-XX-XX - Replaced GLM traits by STL traits when possible - Allowed including individual core feature - Increased unit tests completness -- Added creating of a quaternion from two vectors +- Added creating of a quaternion from two vectors - Added C++11 initializer lists - Fixed umulExtended and imulExtended implementations for vector types (#76)