- Fixed integer pow from GTX_integer with null exponent #658
This commit is contained in:
@@ -31,7 +31,7 @@ namespace glm
|
||||
|
||||
//! Returns x raised to the y power.
|
||||
//! From GLM_GTX_integer extension.
|
||||
GLM_FUNC_DECL int pow(int x, int y);
|
||||
GLM_FUNC_DECL int pow(int x, uint y);
|
||||
|
||||
//! Returns the positive square root of x.
|
||||
//! From GLM_GTX_integer extension.
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
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)
|
||||
result *= x;
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user