WE ARE SO BACK

This commit is contained in:
Jorijn van der Graaf 2026-03-31 11:52:13 +02:00
commit 143b71eeb9
6 changed files with 1339 additions and 608 deletions

View file

@ -333,34 +333,6 @@ namespace Crafter {
}
}
constexpr void Normalize() requires(Packing == 1) {
if constexpr(std::is_same_v<typename VectorBase<Len, Packing, _Float16>::VectorType, __m128h>) {
_Float16 dot = LengthSq();
__m128h vec = _mm_set1_ph(dot);
__m128h sqrt = _mm_sqrt_ph(vec);
this->v = _mm_div_ph(this->v, sqrt);
} else if constexpr(std::is_same_v<typename VectorBase<Len, Packing, _Float16>::VectorType, __m256h>) {
_Float16 dot = LengthSq();
__m256h vec = _mm256_set1_ph(dot);
__m256h sqrt = _mm256_sqrt_ph(vec);
this->v = _mm256_div_ph(this->v, sqrt);
} else {
_Float16 dot = LengthSq();
__m512h vec = _mm512_set1_ph(dot);
__m512h sqrt = _mm512_sqrt_ph(vec);
this->v = _mm512_div_ph(this->v, sqrt);
}
}
constexpr _Float16 Length() const requires(Packing == 1) {
_Float16 Result = LengthSq();
return std::sqrtf(Result);
}
constexpr _Float16 LengthSq() const requires(Packing == 1) {
return Dot(*this, *this);
}
constexpr VectorF16<Len, Packing> Cos() {
if constexpr (std::is_same_v<typename VectorBase<Len, Packing, _Float16>::VectorType, __m128h>) {
__m256 wide = _mm256_cvtph_ps(_mm_castph_si128(this->v));