Compare commits
No commits in common. "d3a26c598960771a545468e4a9efad79f0cd1943" and "68273f8a228fcc61e047c11a9a6ff5c4c331c0d6" have entirely different histories.
d3a26c5989
...
68273f8a22
@ -19,12 +19,12 @@ struct Add : Expr<Add<L, R>>
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
tnvx_ref_or_value_t<L> _l;
|
tnvx_ref_or_value_t<L> _l;
|
||||||
tnvx_ref_or_value_t<R> _r;
|
tnvx_ref_or_value_t<L> _r;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<vec_expr L, vec_expr R>
|
template<vec_expr L, vec_expr R>
|
||||||
[[nodiscard]] TNVX_INLINE
|
[[nodiscard]] TNVX_INLINE
|
||||||
Add<L, R> operator+(const L& l, const R& r) noexcept;
|
Add<L, R> operator+(const L& TNVX_RESTRICT l, const R& TNVX_RESTRICT r) noexcept;
|
||||||
|
|
||||||
template<vec_expr L, vec_expr R>
|
template<vec_expr L, vec_expr R>
|
||||||
inline constexpr bool is_vec_expr<Add<L, R>> = true;
|
inline constexpr bool is_vec_expr<Add<L, R>> = true;
|
||||||
|
|||||||
@ -22,7 +22,7 @@ vf4 Add<L, R>::eval() const noexcept
|
|||||||
|
|
||||||
template<vec_expr L, vec_expr R>
|
template<vec_expr L, vec_expr R>
|
||||||
[[nodiscard]] TNVX_INLINE
|
[[nodiscard]] TNVX_INLINE
|
||||||
Add<L, R> operator+(const L& l, const R& r) noexcept
|
Add<L, R> operator+(const L& TNVX_RESTRICT l, const R& TNVX_RESTRICT r) noexcept
|
||||||
{
|
{
|
||||||
return { l, r };
|
return { l, r };
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ private:
|
|||||||
|
|
||||||
template<vec_expr L, vec_expr R>
|
template<vec_expr L, vec_expr R>
|
||||||
[[nodiscard]] TNVX_INLINE
|
[[nodiscard]] TNVX_INLINE
|
||||||
Cross3<L, R> cross3(const L& l, const R& r) noexcept;
|
Cross3<L, R> cross3(const L& TNVX_RESTRICT l, const R& TNVX_RESTRICT r) noexcept;
|
||||||
|
|
||||||
template<vec_expr L, vec_expr R> inline constexpr bool is_vec_expr<Cross3<L, R>> = true;
|
template<vec_expr L, vec_expr R> inline constexpr bool is_vec_expr<Cross3<L, R>> = true;
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ vf4 Cross3<L, R>::eval() const noexcept
|
|||||||
|
|
||||||
template<vec_expr L, vec_expr R>
|
template<vec_expr L, vec_expr R>
|
||||||
TNVX_INLINE
|
TNVX_INLINE
|
||||||
Cross3<L, R> cross3(const L& l, const R& r) noexcept
|
Cross3<L, R> cross3(const L& TNVX_RESTRICT l, const R& TNVX_RESTRICT r) noexcept
|
||||||
{
|
{
|
||||||
return { l, r };
|
return { l, r };
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ private:
|
|||||||
|
|
||||||
template<vec_expr E>
|
template<vec_expr E>
|
||||||
[[nodiscard]] TNVX_INLINE
|
[[nodiscard]] TNVX_INLINE
|
||||||
Div<E, Scalar> operator/(const E& l, float r) noexcept;
|
Div<E, Scalar> operator/(const E& TNVX_RESTRICT l, float r) noexcept;
|
||||||
|
|
||||||
template<vec_expr L, scalar_expr R> inline constexpr bool is_vec_expr<Div<L, R>> = true;
|
template<vec_expr L, scalar_expr R> inline constexpr bool is_vec_expr<Div<L, R>> = true;
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ vf4 Div<L, R>::eval() const noexcept
|
|||||||
|
|
||||||
template<vec_expr E>
|
template<vec_expr E>
|
||||||
TNVX_INLINE
|
TNVX_INLINE
|
||||||
Div<E, Scalar> operator/(const E& l, float r) noexcept
|
Div<E, Scalar> operator/(const E& TNVX_RESTRICT l, float r) noexcept
|
||||||
{
|
{
|
||||||
return { l, Scalar(r) };
|
return { l, Scalar(r) };
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ private:
|
|||||||
|
|
||||||
template<vec_expr L, vec_expr R>
|
template<vec_expr L, vec_expr R>
|
||||||
[[nodiscard]] TNVX_INLINE
|
[[nodiscard]] TNVX_INLINE
|
||||||
Dot3<L, R> dot3(const L& l, const R& r) noexcept;
|
Dot3<L, R> dot3(const L& TNVX_RESTRICT l, const R& TNVX_RESTRICT r) noexcept;
|
||||||
|
|
||||||
template<vec_expr L, vec_expr R> inline constexpr bool is_scalar_expr<Dot3<L, R>> = true;
|
template<vec_expr L, vec_expr R> inline constexpr bool is_scalar_expr<Dot3<L, R>> = true;
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ Dot3<L, R>::operator float() const noexcept
|
|||||||
|
|
||||||
template<vec_expr L, vec_expr R>
|
template<vec_expr L, vec_expr R>
|
||||||
TNVX_INLINE
|
TNVX_INLINE
|
||||||
Dot3<L, R> dot3(const L& l, const R& r) noexcept
|
Dot3<L, R> dot3(const L& TNVX_RESTRICT l, const R& TNVX_RESTRICT r) noexcept
|
||||||
{
|
{
|
||||||
return { l, r };
|
return { l, r };
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ private:
|
|||||||
|
|
||||||
template<vec_expr E>
|
template<vec_expr E>
|
||||||
TNVX_INLINE
|
TNVX_INLINE
|
||||||
Magn3<E> magnitude3(const E& e) noexcept;
|
Magn3<E> magnitude3(const E& TNVX_RESTRICT e) noexcept;
|
||||||
|
|
||||||
template<vec_expr E> inline constexpr bool is_scalar_expr<Magn3<E>> = true;
|
template<vec_expr E> inline constexpr bool is_scalar_expr<Magn3<E>> = true;
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ Magn3<E>::operator float() const noexcept
|
|||||||
|
|
||||||
template<vec_expr E>
|
template<vec_expr E>
|
||||||
TNVX_INLINE
|
TNVX_INLINE
|
||||||
Magn3<E> magnitude3(const E& e) noexcept
|
Magn3<E> magnitude3(const E& TNVX_RESTRICT e) noexcept
|
||||||
{
|
{
|
||||||
return Magn3<E>(e);
|
return Magn3<E>(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,15 +26,15 @@ private:
|
|||||||
|
|
||||||
template<vec_expr E>
|
template<vec_expr E>
|
||||||
[[nodiscard]] TNVX_INLINE
|
[[nodiscard]] TNVX_INLINE
|
||||||
Mul<E, Scalar> operator*(const E& l, float r) noexcept;
|
Mul<E, Scalar> operator*(const E& TNVX_RESTRICT l, float r) noexcept;
|
||||||
|
|
||||||
template<vec_expr E>
|
template<vec_expr E>
|
||||||
[[nodiscard]] TNVX_INLINE
|
[[nodiscard]] TNVX_INLINE
|
||||||
Mul<Scalar, E> operator*(float l, const E& r) noexcept;
|
Mul<Scalar, E> operator*(float l, const E& TNVX_RESTRICT r) noexcept;
|
||||||
|
|
||||||
template<scalar_expr L, scalar_expr R>
|
template<scalar_expr L, scalar_expr R>
|
||||||
[[nodiscard]] TNVX_INLINE
|
[[nodiscard]] TNVX_INLINE
|
||||||
Mul<L, R> operator*(const L& l, const R& r) noexcept;
|
Mul<L, R> operator*(const L& TNVX_RESTRICT l, const R& TNVX_RESTRICT r) noexcept;
|
||||||
|
|
||||||
template<vec_expr L, scalar_expr R> inline constexpr bool is_vec_expr<Mul<L, R>> = true;
|
template<vec_expr L, scalar_expr R> inline constexpr bool is_vec_expr<Mul<L, R>> = true;
|
||||||
template<scalar_expr L, vec_expr R> inline constexpr bool is_vec_expr<Mul<L, R>> = true;
|
template<scalar_expr L, vec_expr R> inline constexpr bool is_vec_expr<Mul<L, R>> = true;
|
||||||
|
|||||||
@ -22,21 +22,21 @@ vf4 Mul<L, R>::eval() const noexcept
|
|||||||
|
|
||||||
template<vec_expr E>
|
template<vec_expr E>
|
||||||
TNVX_INLINE
|
TNVX_INLINE
|
||||||
Mul<E, Scalar> operator*(const E& l, float r) noexcept
|
Mul<E, Scalar> operator*(const E& TNVX_RESTRICT l, float r) noexcept
|
||||||
{
|
{
|
||||||
return { l, Scalar(r) };
|
return { l, Scalar(r) };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<vec_expr E>
|
template<vec_expr E>
|
||||||
TNVX_INLINE
|
TNVX_INLINE
|
||||||
Mul<Scalar, E> operator*(float l, const E& r) noexcept
|
Mul<Scalar, E> operator*(float l, const E& TNVX_RESTRICT r) noexcept
|
||||||
{
|
{
|
||||||
return { Scalar(l), r };
|
return { Scalar(l), r };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<scalar_expr L, scalar_expr R>
|
template<scalar_expr L, scalar_expr R>
|
||||||
TNVX_INLINE
|
TNVX_INLINE
|
||||||
Mul<L, R> operator*(const L& l, const R& r) noexcept
|
Mul<L, R> operator*(const L& TNVX_RESTRICT l, const R& TNVX_RESTRICT r) noexcept
|
||||||
{
|
{
|
||||||
return { l, r };
|
return { l, r };
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ private:
|
|||||||
|
|
||||||
template<vec_expr E>
|
template<vec_expr E>
|
||||||
[[nodiscard]] TNVX_INLINE
|
[[nodiscard]] TNVX_INLINE
|
||||||
Norm3<E> norm3(const E& e) noexcept;
|
Norm3<E> norm3(const E& TNVX_RESTRICT e) noexcept;
|
||||||
|
|
||||||
template<vec_expr E> inline constexpr bool is_vec_expr<Norm3<E>> = true;
|
template<vec_expr E> inline constexpr bool is_vec_expr<Norm3<E>> = true;
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ vf4 Norm3<E>::eval() const noexcept
|
|||||||
|
|
||||||
template<vec_expr E>
|
template<vec_expr E>
|
||||||
TNVX_INLINE
|
TNVX_INLINE
|
||||||
Norm3<E> norm3(const E& e) noexcept
|
Norm3<E> norm3(const E& TNVX_RESTRICT e) noexcept
|
||||||
{
|
{
|
||||||
return Norm3<E>(e);
|
return Norm3<E>(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,8 +20,6 @@ private:
|
|||||||
vf4 _value;
|
vf4 _value;
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(is_stored_by_value_v<Scalar>, "Scalar must be stored by value");
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline constexpr bool is_scalar_expr<Scalar> = true;
|
inline constexpr bool is_scalar_expr<Scalar> = true;
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@ private:
|
|||||||
|
|
||||||
template<vec_expr L, vec_expr R>
|
template<vec_expr L, vec_expr R>
|
||||||
[[nodiscard]] TNVX_INLINE
|
[[nodiscard]] TNVX_INLINE
|
||||||
Sub<L, R> operator-(const L& l, const R& r) noexcept;
|
Sub<L, R> operator-(const L& TNVX_RESTRICT l, const R& TNVX_RESTRICT r) noexcept;
|
||||||
|
|
||||||
template<vec_expr L, vec_expr R> inline constexpr bool is_vec_expr<Sub<L, R>> = true;
|
template<vec_expr L, vec_expr R> inline constexpr bool is_vec_expr<Sub<L, R>> = true;
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ vf4 Sub<L, R>::eval() const noexcept
|
|||||||
|
|
||||||
template<vec_expr L, vec_expr R>
|
template<vec_expr L, vec_expr R>
|
||||||
TNVX_INLINE
|
TNVX_INLINE
|
||||||
Sub<L, R> operator-(const L& l, const R& r) noexcept
|
Sub<L, R> operator-(const L& TNVX_RESTRICT l, const R& TNVX_RESTRICT r) noexcept
|
||||||
{
|
{
|
||||||
return { l, r };
|
return { l, r };
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ struct alignas(16) vec4 : Expr<vec4>
|
|||||||
|
|
||||||
template<vec_expr E>
|
template<vec_expr E>
|
||||||
TNVX_INLINE
|
TNVX_INLINE
|
||||||
vec4(const E& e) noexcept;
|
vec4(const E& TNVX_RESTRICT e) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] TNVX_INLINE
|
[[nodiscard]] TNVX_INLINE
|
||||||
vf4 eval() const noexcept;
|
vf4 eval() const noexcept;
|
||||||
|
|||||||
@ -19,7 +19,7 @@ __m128 vec4::eval() const noexcept
|
|||||||
|
|
||||||
template<vec_expr E>
|
template<vec_expr E>
|
||||||
TNVX_INLINE
|
TNVX_INLINE
|
||||||
vec4::vec4(const E& e) noexcept
|
vec4::vec4(const E& TNVX_RESTRICT e) noexcept
|
||||||
: _data(e.eval())
|
: _data(e.eval())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,7 +169,7 @@ TEST(vec4, dot_commutative)
|
|||||||
TEST(vec4, norm_magnitude)
|
TEST(vec4, norm_magnitude)
|
||||||
{
|
{
|
||||||
vec4 a = { 3.0f, 1.0f, 4.0f, 0.0f };
|
vec4 a = { 3.0f, 1.0f, 4.0f, 0.0f };
|
||||||
EXPECT_NEAR(magnitude3(norm3(a)), 1.0f, 1e-6f);
|
EXPECT_NEAR(magnitude3(norm3(a)), 1.0f, 1e-5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(vec4, dot_perpendicular)
|
TEST(vec4, dot_perpendicular)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user