Allow setting a suffix for constants and trigonometric functions

In order to use constants or trigonometric functions with a type other than
double, a suffix ('f' for float or 'l' for long double) has to be used in C.
This commit adds a preprocessor macro 'kiss_fft_suffix' which can be set to
either 'f' or 'l' and which will be added to floating point constants and to
the trigonometric functions (sin and cos).

Without this suffix, the code will use a too high precision for float and a
too low precision for long double.
This commit is contained in:
Steffen Kieß
2019-09-24 14:16:06 +02:00
parent 1efe72041e
commit 5ebbc5e618
4 changed files with 57 additions and 7 deletions

View File

@ -35,6 +35,8 @@ extern "C" {
#ifdef USE_SIMD
# include <xmmintrin.h>
# define kiss_fft_scalar __m128
# define kiss_fft_scalar_one double
//# define kiss_fft_scalar_one float
# ifndef KISS_FFT_MALLOC
# define KISS_FFT_MALLOC(nbytes) _mm_malloc(nbytes,16)
# endif
@ -55,8 +57,10 @@ extern "C" {
#include <stdint.h>
# if (FIXED_POINT == 32)
# define kiss_fft_scalar int32_t
# define kiss_fft_scalar_one double
# else
# define kiss_fft_scalar int16_t
# define kiss_fft_scalar_one double
# endif
#else
# ifndef kiss_fft_scalar