* added utility class is_power_of_two
* added variable template is_power_of_two_v
This commit is contained in:
Michele Caini
2021-08-29 22:15:33 +02:00
parent 98f785d199
commit a595c6ec6f
2 changed files with 26 additions and 0 deletions
+10
View File
@@ -31,3 +31,13 @@ TEST(Memory, PoccaPocmaAndPocs) {
entt::propagate_on_container_move_assignment(lhs, rhs);
entt::propagate_on_container_swap(lhs, rhs);
}
TEST(Memory, IsPowerOfTwo) {
ASSERT_FALSE(entt::is_power_of_two_v<0u>);
ASSERT_TRUE(entt::is_power_of_two_v<1u>);
ASSERT_TRUE(entt::is_power_of_two_v<2u>);
ASSERT_TRUE(entt::is_power_of_two_v<4u>);
ASSERT_FALSE(entt::is_power_of_two_v<7u>);
ASSERT_TRUE(entt::is_power_of_two_v<128u>);
ASSERT_FALSE(entt::is_power_of_two_v<200u>);
}