From d05806450a1598a1574f9e53b2db353c1ab2da3b Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Thu, 8 Oct 2020 11:20:52 +0100 Subject: [PATCH] Avoid compiler complaints about dynamic array syntax. This is no better code, bu t it's less sensitive to compile options. --- src/system/VectorOps.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/system/VectorOps.h b/src/system/VectorOps.h index fc1d0f6c..92694e1b 100644 --- a/src/system/VectorOps.h +++ b/src/system/VectorOps.h @@ -38,6 +38,7 @@ #ifdef HAVE_VDSP #include +#include #endif #include @@ -521,7 +522,7 @@ template<> inline void v_log(float *const R__ dst, const int count) { - float tmp[count]; + float *tmp = (float *)alloca(count * sizeof(float)); vvlogf(tmp, dst, &count); v_copy(dst, tmp, count); } @@ -529,7 +530,7 @@ template<> inline void v_log(double *const R__ dst, const int count) { - double tmp[count]; + double *tmp = (double *)alloca(count * sizeof(double)); vvlog(tmp, dst, &count); v_copy(dst, tmp, count); } @@ -566,7 +567,7 @@ template<> inline void v_exp(float *const R__ dst, const int count) { - float tmp[count]; + float *tmp = (float *)alloca(count * sizeof(float)); vvexpf(tmp, dst, &count); v_copy(dst, tmp, count); } @@ -574,7 +575,7 @@ template<> inline void v_exp(double *const R__ dst, const int count) { - double tmp[count]; + double *tmp = (double *)alloca(count * sizeof(double)); vvexp(tmp, dst, &count); v_copy(dst, tmp, count); } @@ -611,7 +612,7 @@ template<> inline void v_sqrt(float *const R__ dst, const int count) { - float tmp[count]; + float *tmp = (float *)alloca(count * sizeof(float)); vvsqrtf(tmp, dst, &count); v_copy(dst, tmp, count); } @@ -619,7 +620,7 @@ template<> inline void v_sqrt(double *const R__ dst, const int count) { - double tmp[count]; + double *tmp = (double *)alloca(count * sizeof(double)); vvsqrt(tmp, dst, &count); v_copy(dst, tmp, count); } @@ -676,7 +677,7 @@ template<> inline void v_abs(float *const R__ dst, const int count) { - float tmp[count]; + float *tmp = (float *)alloca(count * sizeof(float)); #if TARGET_OS_IPHONE vvfabsf(tmp, dst, &count); #elif (defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED < 1070)