8f1295fa2ed4 — Chris Cannam 17 days ago
Avoid compiler complaints about dynamic array syntax. This is no better code, bu
t it's less sensitive to compile options.
1 files changed, 8 insertions(+), 7 deletions(-)

M src/system/VectorOps.h
M src/system/VectorOps.h +8 -7
@@ 38,6 38,7 @@ 
 
 #ifdef HAVE_VDSP
 #include <Accelerate/Accelerate.h>
+#include <alloca.h>
 #endif
 
 #include <cstring>

          
@@ 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)