From 658369dfc1511a64794533b4fa629a59a9ea3851 Mon Sep 17 00:00:00 2001 From: lhprojects Date: Tue, 10 Jul 2018 22:46:45 +0800 Subject: [PATCH] Update kissfft.hh Support for Visual C++ which doesn't support dynamic array in the stack. --- kissfft.hh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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;