Skip to content

Commit

Permalink
Avoid compiler complaints about dynamic array syntax. This is no bett…
Browse files Browse the repository at this point in the history
…er code, bu

t it's less sensitive to compile options.
  • Loading branch information
cannam committed Oct 8, 2020
1 parent 42ff18a commit d058064
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/system/VectorOps.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

#ifdef HAVE_VDSP
#include <Accelerate/Accelerate.h>
#include <alloca.h>
#endif

#include <cstring>
Expand Down Expand Up @@ -521,15 +522,15 @@ 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);
}
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);
}
Expand Down Expand Up @@ -566,15 +567,15 @@ 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);
}
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);
}
Expand Down Expand Up @@ -611,15 +612,15 @@ 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);
}
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);
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d058064

Please sign in to comment.