Skip to content

Commit

Permalink
Merge pull request #1 from john-h-k/patch-1
Browse files Browse the repository at this point in the history
Fix dot
  • Loading branch information
Pitj3 authored Jun 27, 2020
2 parents f1a02cf + de772f0 commit 3b0d60e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions sml/include/vec3.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,9 @@ namespace sml
{
__m128 me = _mm_load_ps(v);
__m128 ot = _mm_load_ps(other.v);
__m128 product = _mm_mul_ps(me, ot);
__m128 dp = _mm_hadd_ps(product, product);
__m128 dp = _mm_dp_ps(me, ot, 0x7f);

s32 res = _mm_extract_epi32(static_cast<__m128i>(_mm_hadd_ps(dp, dp)), 0);

return *reinterpret_cast<f32*>(&(res));
return _mm_cvtss_f32(dp);
}

return (x * other.x) + (y * other.y) + (z * other.z);
Expand Down Expand Up @@ -647,4 +644,4 @@ namespace sml
}
} // namespace sml

#endif // sml_vec3_h__
#endif // sml_vec3_h__

0 comments on commit 3b0d60e

Please sign in to comment.