Fixed reverse

This commit is contained in:
Christophe Riccio 2011-05-07 16:20:26 +01:00
parent ac1fe72af1
commit 9a11b8155e

View File

@ -394,13 +394,14 @@ namespace glm
template <typename genIUType>
inline genIUType bitfieldReverse(genIUType const & Value)
{
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'bitfieldReverse' only accept integer values");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_integer, "'bitRevert' only accept integer values");
genIUType Result = 0;
for(std::size_t i = 0; i < sizeof(genIUType) * std::size_t(8); ++i)
if(Value & (1 << i))
Result |= (genIUType(1) << (sizeof(genIUType) * std::size_t(8)) - genIUType(1) - i);
return Result;
genIUType Out = 0;
std::size_t BitSize = sizeof(genIUType) * 8;
for(std::size_t i = 0; i < BitSize; ++i)
if(In & (genIUType(1) << i))
Out |= genIUType(1) << (BitSize - 1 - i);
return Out;
}
template <typename T>