Added testpow2 test, and use improved version. Issue #184.

This commit is contained in:
Branimir Karadžić
2018-05-30 12:58:47 -07:00
parent 7a10c90e1a
commit e930ad8fa1
2 changed files with 18 additions and 6 deletions

View File

@@ -69,3 +69,17 @@ TEST_CASE("halfTo/FromFloat", "")
REQUIRE(orig == hff);
}
}
TEST_CASE("uint32_testpow2", "")
{
uint32_t shift = 0;
for (uint32_t ii = 0; ii < UINT32_MAX; ++ii)
{
if (bx::uint32_testpow2(ii) )
{
REQUIRE(ii == 1 << shift);
++shift;
}
}
}