From 9d998bd390a0a659111dbef6f4f2f9ca774872ad Mon Sep 17 00:00:00 2001 From: Alex Spataru Date: Mon, 25 Nov 2024 00:07:07 -0500 Subject: [PATCH] Fix SSE2 compilation error --- app/src/SIMD/SIMD.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/SIMD/SIMD.h b/app/src/SIMD/SIMD.h index 7c8f3a37..74257801 100644 --- a/app/src/SIMD/SIMD.h +++ b/app/src/SIMD/SIMD.h @@ -28,6 +28,10 @@ #include #include +#ifdef _WIN32 +# include +#endif + #if defined(CPU_X86_64) # include #endif @@ -271,7 +275,7 @@ inline T findMax(const T *data, size_t count) // Reduce SIMD register to scalar T maxVal = data[0]; - std::vector buffer(simdWidth); // Replace VLAs with std::vector + std::vector buffer(simdWidth); simde_mm_storeu_pd(buffer.data(), maxVec); for (size_t j = 0; j < simdWidth; ++j) maxVal = std::max(maxVal, buffer[j]); @@ -359,10 +363,10 @@ inline qreal findMin(const QVector &data, Extractor extractor) } // Reduce SIMD register to scalar - alignas(16) qreal buffer[sseWidth]; + alignas(16) qreal buffer[simdWith]; simde_mm_storeu_pd(buffer, minVec); qreal minVal = buffer[0]; - for (int j = 1; j < sseWidth; ++j) + for (size_t j = 1; j < simdWith; ++j) minVal = std::min(minVal, buffer[j]); #elif defined(CPU_ARM64) @@ -438,10 +442,10 @@ inline qreal findMax(const QVector &data, Extractor extractor) } // Reduce SIMD register to scalar - alignas(16) qreal buffer[sseWidth]; + alignas(16) qreal buffer[simdWith]; simde_mm_storeu_pd(buffer, maxVec); qreal maxVal = buffer[0]; - for (int j = 1; j < sseWidth; ++j) + for (size_t j = 1; j < simdWith; ++j) maxVal = std::max(maxVal, buffer[j]); #elif defined(CPU_ARM64)