From 6e609342d65adfc998ccd9484434e31612a0578f Mon Sep 17 00:00:00 2001 From: oltolm Date: Mon, 27 Nov 2023 19:23:50 +0100 Subject: [PATCH] fix ASAN error in Vec2::Length() --- GPU/Math3D.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GPU/Math3D.cpp b/GPU/Math3D.cpp index 22ad0f86d8..c4a6c7ea6d 100644 --- a/GPU/Math3D.cpp +++ b/GPU/Math3D.cpp @@ -26,7 +26,8 @@ float Vec2::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);