Skip to content

Commit

Permalink
fix(core): use if constexpr when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
luishfonseca committed Sep 28, 2023
1 parent 3d54b8c commit fe2d258
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/tests/reflection/external/glm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ static void testMat(const char* name, glm::mat<C, R, T, Q> mat, glm::vec<R, T, Q
CHECK(&*fields.begin() == fields.field("a"));
CHECK(&*++fields.begin() == fields.field("b"));

if (C >= 3)
if constexpr (C >= 3)
{
CHECK(&*++(++fields.begin()) == fields.field("c"));
}

if (C >= 4)
if constexpr (C >= 4)
{
CHECK(&*++(++(++fields.begin())) == fields.field("d"));
}
Expand Down Expand Up @@ -71,12 +71,12 @@ static void testVec(const char* name, glm::vec<L, T, Q> vec)
CHECK(&*fields.begin() == fields.field("x"));
CHECK(&*++fields.begin() == fields.field("y"));

if (L >= 3)
if constexpr (L >= 3)
{
CHECK(&*++(++fields.begin()) == fields.field("z"));
}

if (L >= 4)
if constexpr (L >= 4)
{
CHECK(&*++(++(++fields.begin())) == fields.field("w"));
}
Expand Down

0 comments on commit fe2d258

Please sign in to comment.