Compare commits

..

2 Commits

3 changed files with 19 additions and 6 deletions

View File

@ -29,6 +29,7 @@ __m128 Norm<E>::eval() const noexcept
}
template<vector_expression E>
TNVX_INLINE
Norm<E> norm(const Expr<E>& e) noexcept
{
return { e.self() };

View File

@ -28,10 +28,10 @@ struct alignas(16) vec4 : Expr<vec4>
__m128 eval() const noexcept;
[[nodiscard]] inline
float magnitude() const noexcept;
auto magnitude() const noexcept;
[[nodiscard]] inline
vec4 norm() const noexcept;
auto norm() const noexcept;
[[nodiscard]] inline
float x() const noexcept;

View File

@ -35,17 +35,29 @@ __m128 vec4::eval() const noexcept
}
TNVX_INLINE
float vec4::magnitude() const noexcept
auto vec4::magnitude() const noexcept
{
return _mm_cvtss_f32(Magnitude<vec4>(*this).eval());
return Magnitude<vec4>(*this);
}
TNVX_INLINE
vec4 vec4::norm() const noexcept
auto vec4::norm() const noexcept
{
return { Norm<vec4>(*this) };
return Norm<vec4>(*this);
}
//TNVX_INLINE
//Magnitude<vec4> vec4::magnitude() const noexcept
//{
// return { *this };
//}
//
//TNVX_INLINE
//Norm<vec4> vec4::norm() const noexcept
//{
// return { *this };
//}
TNVX_INLINE
float vec4::x() const noexcept
{