提交 9a11b815 编写于 作者: C Christophe Riccio

Fixed reverse

上级 ac1fe72a
......@@ -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");
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;
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_integer, "'bitRevert' only accept integer values");
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>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册