Skip to content

Commit

Permalink
Improved ***PowerOfTwo
Browse files Browse the repository at this point in the history
  • Loading branch information
Groovounet committed Apr 29, 2016
1 parent 68ec048 commit 872aa9d
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions test/gtc/gtc_round.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ namespace isPowerOfTwo
}
}//isPowerOfTwo

namespace ceilPowerOfTwo
namespace ceilPowerOfTwo_advanced
{
template <typename genIUType>
GLM_FUNC_QUALIFIER genIUType highestBitValue(genIUType Value)
Expand Down Expand Up @@ -292,7 +292,7 @@ namespace ceilPowerOfTwo

return Error;
}
}//namespace ceilPowerOfTwo
}//namespace ceilPowerOfTwo_advanced

namespace roundPowerOfTwo
{
Expand Down Expand Up @@ -341,6 +341,25 @@ namespace floorPowerOfTwo
}
}//namespace floorPowerOfTwo

namespace ceilPowerOfTwo
{
int test()
{
int Error = 0;

glm::uint32 const A = glm::ceilPowerOfTwo(7u);
Error += A == 8u ? 0 : 1;

glm::uint32 const B = glm::ceilPowerOfTwo(15u);
Error += B == 16u ? 0 : 1;

glm::uint32 const C = glm::ceilPowerOfTwo(31u);
Error += C == 32u ? 0 : 1;

return Error;
}
}//namespace ceilPowerOfTwo

namespace floorMultiple
{
template <typename genType>
Expand Down Expand Up @@ -426,10 +445,11 @@ int main()
int Error(0);

Error += isPowerOfTwo::test();
Error += ceilPowerOfTwo::test();
Error += floorPowerOfTwo::test();
Error += roundPowerOfTwo::test();

Error += ceilPowerOfTwo::test();
Error += ceilPowerOfTwo_advanced::test();

# ifdef NDEBUG
Error += ceilPowerOfTwo::perf();
# endif//NDEBUG
Expand Down

0 comments on commit 872aa9d

Please sign in to comment.