This commit is contained in:
Бранимир Караџић
2023-11-18 14:43:35 -08:00
parent 4c87a58af0
commit fe540e7657
3 changed files with 32 additions and 28 deletions

View File

@@ -124,16 +124,22 @@ TEST_CASE("halfTo/FromFloat", "[uint32_t]")
}
}
TEST_CASE("uint32_testpow2")
TEST_CASE("uint32_testpow2", "[uint32_t]")
{
uint32_t shift = 0;
uint32_t nextpow2 = bx::uint32_nextpow2(1);
for (uint32_t ii = 0; ii < UINT32_MAX; ++ii)
for (uint32_t ii = 1; ii < 1<<24; ++ii)
{
REQUIRE(nextpow2 == bx::uint32_nextpow2(ii) );
if (bx::uint32_testpow2(ii) )
{
REQUIRE(ii == 1u << shift);
++shift;
REQUIRE(ii == nextpow2);
nextpow2 = bx::uint32_nextpow2(ii+1);
}
}
}