I'm Working on FFTW (Fastest Fourier Transform in the West) and came over this C function. I did not understand the declaration of this function where parameters are present inside ()(). I never saw a declaration as such. Can anyone brief it out?
void X(execute_dft_r2c)(const X(plan) p, R *in, C *out)
{
/*
*Body
*/
}
X is a macro that adds a precision-naming prefix depending on compilation parameters.
I believe the point (at least one of them) is to avoid mismatches by causing errors if source files have been compiled with different precision settings.
(C does not have type-safe linkage.)
Look in fftw3/kernel/ifftw.h:
/* determine precision and name-mangling scheme */
#define CONCAT(prefix, name) prefix ## name
#if defined(FFTW_SINGLE)
typedef float R;
# define X(name) CONCAT(fftwf_, name)
#elif defined(FFTW_LDOUBLE)
typedef long double R;
# define X(name) CONCAT(fftwl_, name)
# define TRIGREAL_IS_LONG_DOUBLE
#elif defined(FFTW_QUAD)
typedef __float128 R;
# define X(name) CONCAT(fftwq_, name)
# define TRIGREAL_IS_QUAD
#else
typedef double R;
# define X(name) CONCAT(fftw_, name)
#endif
In the first case, your declaration expands to
void fftwf_execute_dft_r2c(const fftwf_plan p, R *in, C *out)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With