Added lowestBitValue to GTX_bit #536

This commit is contained in:
Christophe Riccio 2016-08-07 12:56:49 +02:00
parent f71171d49b
commit 4db0dfcb19
3 changed files with 20 additions and 0 deletions

View File

@ -29,6 +29,10 @@ namespace glm
template <typename genIUType>
GLM_FUNC_DECL genIUType highestBitValue(genIUType Value);
/// @see gtx_bit
template <typename genIUType>
GLM_FUNC_DECL genIUType lowestBitValue(genIUType Value);
/// Find the highest bit set to 1 in a integer variable and return its value.
///
/// @see gtx_bit

View File

@ -25,6 +25,21 @@ namespace glm
return detail::functor1<T, T, P, vecType>::call(highestBitValue, v);
}
///////////////////
// lowestBitValue
template <typename genIUType>
GLM_FUNC_QUALIFIER genIUType lowestBitValue(genIUType Value)
{
return (Value & (~Value + 1));
}
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> lowestBitValue(vecType<T, P> const & v)
{
return detail::functor1<T, T, P, vecType>::call(lowestBitValue, v);
}
///////////////////
// powerOfTwoAbove

View File

@ -67,6 +67,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
- Added GTC_type_aligned with aligned *vec* types
- Added GTC_functions extension
- Added quaternion version of isnan and isinf #521
- Added lowestBitValue to GTX_bit #536
##### Improvements:
- Improved SIMD and swizzle operators interactions with GCC and Clang #474