Added nlz, improved int log2, optimized findMSB with intrinsics

This commit is contained in:
Christophe Riccio
2011-10-11 19:15:41 +01:00
parent 09ee14ad4c
commit 3c2882439f
4 changed files with 139 additions and 119 deletions

View File

@@ -58,10 +58,14 @@ namespace glm
//! From GLM_GTX_integer extension.
int sqrt(int x);
//! Returns the log2 of x.
//! Returns the log2 of x. Can be reliably using to compute mipmap count from the texture size.
//! From GLM_GTX_integer extension.
unsigned int log2(unsigned int x);
//! Returns the floor log2 of x.
//! From GLM_GTX_integer extension.
unsigned int floor_log2(unsigned int x);
//! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y.
//! From GLM_GTX_integer extension.
int mod(int x, int y);
@@ -72,21 +76,25 @@ namespace glm
genType factorial(genType const & x);
//! 32bit signed integer.
//! From GLM_GTX_unsigned_int extension.
//! From GLM_GTX_integer extension.
typedef signed int sint;
//! Returns x raised to the y power.
//! From GLM_GTX_unsigned_int extension.
//! From GLM_GTX_integer extension.
uint pow(uint x, uint y);
//! Returns the positive square root of x.
//! From GLM_GTX_unsigned_int extension.
//! From GLM_GTX_integer extension.
uint sqrt(uint x);
//! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y.
//! From GLM_GTX_unsigned_int extension.
//! From GLM_GTX_integer extension.
uint mod(uint x, uint y);
//! Returns the number of leading zeros.
//! From GLM_GTX_integer extension.
uint nlz(uint x);
/// @}
}//namespace glm