Avoid double imaginary swap on COMPLEX_INPUT and Reverse direction

develop
Enrique Condes 2024-11-24 22:15:36 +08:00
rodzic f67d6797b4
commit a1abeabe32
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -82,11 +82,12 @@ void ArduinoFFT<T>::compute(T *vReal, T *vImag, uint_fast16_t samples,
for (uint_fast16_t i = 0; i < (samples - 1); i++) {
if (i < j) {
swap(&vReal[i], &vReal[j]);
#ifdef COMPLEX_INPUT
#ifdef COMPLEX_INPUT
swap(&vImag[i], &vImag[j]);
#endif
#else
if (dir == FFTDirection::Reverse)
swap(&vImag[i], &vImag[j]);
#endif
}
uint_fast16_t k = (samples >> 1);