make a bit more readable

This commit is contained in:
Tr1NgleDev 2024-11-02 17:38:34 +08:00
parent ce1448a903
commit 9097b1469b
3 changed files with 43 additions and 42 deletions

View File

@ -107,11 +107,11 @@ namespace glm
{ {
GLM_ASSERT_LENGTH(i, this->length()); GLM_ASSERT_LENGTH(i, this->length());
# if GLM_LANG & GLM_LANG_CXX14_FLAG || GLM_LANG & GLM_LANG_CXX17_FLAG #if GLM_LANG & GLM_LANG_CXX14_FLAG || GLM_LANG & GLM_LANG_CXX17_FLAG
# if GLM_LANG & GLM_LANG_CXX20_FLAG #if GLM_LANG & GLM_LANG_CXX20_FLAG
if (std::is_constant_evaluated()) if (std::is_constant_evaluated())
{ {
# endif #endif
switch (i) switch (i)
{ {
default: default:
@ -120,16 +120,16 @@ namespace glm
case 1: case 1:
return y; return y;
} }
# if GLM_LANG & GLM_LANG_CXX20_FLAG #if GLM_LANG & GLM_LANG_CXX20_FLAG
} }
else else
{ {
return (&x)[i]; return (&x)[i];
} }
# endif #endif
# else #else
return (&x)[i]; return (&x)[i];
# endif #endif
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
@ -137,11 +137,11 @@ namespace glm
{ {
GLM_ASSERT_LENGTH(i, this->length()); GLM_ASSERT_LENGTH(i, this->length());
# if GLM_LANG & GLM_LANG_CXX14_FLAG || GLM_LANG & GLM_LANG_CXX17_FLAG #if GLM_LANG & GLM_LANG_CXX14_FLAG || GLM_LANG & GLM_LANG_CXX17_FLAG
# if GLM_LANG & GLM_LANG_CXX20_FLAG #if GLM_LANG & GLM_LANG_CXX20_FLAG
if (std::is_constant_evaluated()) if (std::is_constant_evaluated())
{ {
# endif #endif
switch (i) switch (i)
{ {
default: default:
@ -150,16 +150,16 @@ namespace glm
case 1: case 1:
return y; return y;
} }
# if GLM_LANG & GLM_LANG_CXX20_FLAG #if GLM_LANG & GLM_LANG_CXX20_FLAG
} }
else else
{ {
return (&x)[i]; return (&x)[i];
} }
# endif #endif
# else #else
return (&x)[i]; return (&x)[i];
# endif #endif
} }
// -- Unary arithmetic operators -- // -- Unary arithmetic operators --

View File

@ -171,11 +171,12 @@ namespace glm
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T & vec<3, T, Q>::operator[](typename vec<3, T, Q>::length_type i) GLM_FUNC_QUALIFIER GLM_CONSTEXPR T & vec<3, T, Q>::operator[](typename vec<3, T, Q>::length_type i)
{ {
GLM_ASSERT_LENGTH(i, this->length()); GLM_ASSERT_LENGTH(i, this->length());
# if GLM_LANG & GLM_LANG_CXX14_FLAG || GLM_LANG & GLM_LANG_CXX17_FLAG
# if GLM_LANG & GLM_LANG_CXX20_FLAG #if GLM_LANG & GLM_LANG_CXX14_FLAG || GLM_LANG & GLM_LANG_CXX17_FLAG
#if GLM_LANG & GLM_LANG_CXX20_FLAG
if (std::is_constant_evaluated()) if (std::is_constant_evaluated())
{ {
# endif #endif
switch (i) switch (i)
{ {
default: default:
@ -186,16 +187,16 @@ namespace glm
case 2: case 2:
return z; return z;
} }
# if GLM_LANG & GLM_LANG_CXX20_FLAG #if GLM_LANG & GLM_LANG_CXX20_FLAG
} }
else else
{ {
return (&x)[i]; return (&x)[i];
} }
# endif #endif
# else #else
return (&x)[i]; return (&x)[i];
# endif #endif
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
@ -203,11 +204,11 @@ namespace glm
{ {
GLM_ASSERT_LENGTH(i, this->length()); GLM_ASSERT_LENGTH(i, this->length());
# if GLM_LANG & GLM_LANG_CXX14_FLAG || GLM_LANG & GLM_LANG_CXX17_FLAG #if GLM_LANG & GLM_LANG_CXX14_FLAG || GLM_LANG & GLM_LANG_CXX17_FLAG
# if GLM_LANG & GLM_LANG_CXX20_FLAG #if GLM_LANG & GLM_LANG_CXX20_FLAG
if (std::is_constant_evaluated()) if (std::is_constant_evaluated())
{ {
# endif #endif
switch (i) switch (i)
{ {
default: default:
@ -218,16 +219,16 @@ namespace glm
case 2: case 2:
return z; return z;
} }
# if GLM_LANG & GLM_LANG_CXX20_FLAG #if GLM_LANG & GLM_LANG_CXX20_FLAG
} }
else else
{ {
return (&x)[i]; return (&x)[i];
} }
# endif #endif
# else #else
return (&x)[i]; return (&x)[i];
# endif #endif
} }
// -- Unary arithmetic operators -- // -- Unary arithmetic operators --

View File

@ -363,11 +363,11 @@ namespace detail
{ {
GLM_ASSERT_LENGTH(i, this->length()); GLM_ASSERT_LENGTH(i, this->length());
# if GLM_LANG & GLM_LANG_CXX14_FLAG || GLM_LANG & GLM_LANG_CXX17_FLAG #if GLM_LANG & GLM_LANG_CXX14_FLAG || GLM_LANG & GLM_LANG_CXX17_FLAG
# if GLM_LANG & GLM_LANG_CXX20_FLAG #if GLM_LANG & GLM_LANG_CXX20_FLAG
if (std::is_constant_evaluated()) if (std::is_constant_evaluated())
{ {
# endif #endif
switch (i) switch (i)
{ {
default: default:
@ -380,16 +380,16 @@ namespace detail
case 3: case 3:
return w; return w;
} }
# if GLM_LANG & GLM_LANG_CXX20_FLAG #if GLM_LANG & GLM_LANG_CXX20_FLAG
} }
else else
{ {
return (&x)[i]; return (&x)[i];
} }
# endif #endif
# else #else
return (&x)[i]; return (&x)[i];
# endif #endif
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
@ -397,11 +397,11 @@ namespace detail
{ {
GLM_ASSERT_LENGTH(i, this->length()); GLM_ASSERT_LENGTH(i, this->length());
# if GLM_LANG & GLM_LANG_CXX14_FLAG || GLM_LANG & GLM_LANG_CXX17_FLAG #if GLM_LANG & GLM_LANG_CXX14_FLAG || GLM_LANG & GLM_LANG_CXX17_FLAG
# if GLM_LANG & GLM_LANG_CXX20_FLAG #if GLM_LANG & GLM_LANG_CXX20_FLAG
if (std::is_constant_evaluated()) if (std::is_constant_evaluated())
{ {
# endif #endif
switch (i) switch (i)
{ {
default: default:
@ -414,16 +414,16 @@ namespace detail
case 3: case 3:
return w; return w;
} }
# if GLM_LANG & GLM_LANG_CXX20_FLAG #if GLM_LANG & GLM_LANG_CXX20_FLAG
} }
else else
{ {
return (&x)[i]; return (&x)[i];
} }
# endif #endif
# else #else
return (&x)[i]; return (&x)[i];
# endif #endif
} }
// -- Unary arithmetic operators -- // -- Unary arithmetic operators --