diff --git a/kissfft.hh b/kissfft.hh index afa7b78..fed2c95 100644 --- a/kissfft.hh +++ b/kissfft.hh @@ -3,7 +3,7 @@ #include #include #include - +#include template class kissfft @@ -318,7 +318,12 @@ class kissfft ) const { const cpx_t * twiddles = &_twiddles[0]; - cpx_t scratchbuf[p]; + cpx_t *scratchbuf; + cpx_t scratchbuf_s[32]; + if (p > 32) scratchbuf = (cpx_t *)malloc(p*sizeof(cpx_t)); + else scratchbuf = scratchbuf_s; + + for ( std::size_t u=0; u 32) free(scratchbuf); } std::size_t _nfft;