Added multiple 'sign' implementations for integers, unit tests and performancetests.
This commit is contained in:
@@ -57,14 +57,14 @@ namespace glm
|
||||
/// Build a mask of 'count' bits
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType mask(genType Bits);
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL genIUType mask(genIUType Bits);
|
||||
|
||||
/// Build a mask of 'count' bits
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> mask(vecType<T, P> const & v);
|
||||
template <typename T, precision P, template <typename, precision> class vecIUType>
|
||||
GLM_FUNC_DECL vecIUType<T, P> mask(vecIUType<T, P> const & v);
|
||||
|
||||
/// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.
|
||||
///
|
||||
|
||||
@@ -245,16 +245,16 @@ namespace detail
|
||||
}
|
||||
}//namespace detail
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType mask(genType Bits)
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER genIUType mask(genIUType Bits)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIType>::is_integer, "'mask' accepts only integer values");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'mask' accepts only integer values");
|
||||
|
||||
return ~((~static_cast<genType>(0)) << Bits);
|
||||
return ~((~static_cast<genIUType>(0)) << Bits);
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> mask(vecType<T, P> const & v)
|
||||
template <typename T, precision P, template <typename, precision> class vecIUType>
|
||||
GLM_FUNC_QUALIFIER vecIUType<T, P> mask(vecIUType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'mask' accepts only integer values");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user