fftw.cpp: remove repeated code