Skip to content

Commit

Permalink
Merge pull request #18493 from oltolm/asan_bug
Browse files Browse the repository at this point in the history
fix ASAN error in Vec2<float>::Length()
  • Loading branch information
hrydgard committed Dec 8, 2023
2 parents e5a91e3 + 6e60934 commit f8eb042
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion GPU/Math3D.cpp
Expand Up @@ -26,7 +26,8 @@ float Vec2<float>::Length() const
// Doubt this is worth it for a vec2 :/
#if defined(_M_SSE)
float ret;
__m128 xy = _mm_loadu_ps(&x);
__m128d tmp = _mm_load_sd((const double*)&x);
__m128 xy = _mm_castpd_ps(tmp);
__m128 sq = _mm_mul_ps(xy, xy);
const __m128 r2 = _mm_shuffle_ps(sq, sq, _MM_SHUFFLE(0, 0, 0, 1));
const __m128 res = _mm_add_ss(sq, r2);
Expand Down

0 comments on commit f8eb042

Please sign in to comment.