Skip to content

Commit

Permalink
Add GLM_FORCE_UNRESTRICTED_FLOAT to skip static assert when using not…
Browse files Browse the repository at this point in the history
… float types
  • Loading branch information
christophe authored and christophe-lunarg committed Dec 25, 2023
1 parent 869f9da commit 8e2bdd1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions glm/gtx/norm.inl
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ namespace detail
template<typename genType>
GLM_FUNC_QUALIFIER genType length2(genType x)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'length2' accepts only floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'length2' accepts only floating-point inputs");
return x * x;
}

template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER T length2(vec<L, T, Q> const& v)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'length2' accepts only floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'length2' accepts only floating-point inputs");
return detail::compute_length2<L, T, Q, detail::is_aligned<Q>::value>::call(v);
}

template<typename T>
GLM_FUNC_QUALIFIER T distance2(T p0, T p1)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'distance2' accepts only floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'distance2' accepts only floating-point inputs");
return length2(p1 - p0);
}

template<length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER T distance2(vec<L, T, Q> const& p0, vec<L, T, Q> const& p1)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_SCALAR_TYPES, "'distance2' accepts only floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'distance2' accepts only floating-point inputs");
return length2(p1 - p0);
}

Expand Down

0 comments on commit 8e2bdd1

Please sign in to comment.