mirror of
https://github.com/mborgerding/kissfft.git
synced 2025-06-04 01:28:23 -04:00
Include stdint.h only where fixed point types are used. Use min/max values from stdint.h.
This commit is contained in:
parent
a75f08488c
commit
d1f9113c51
@ -12,7 +12,6 @@
|
|||||||
typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */
|
typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */
|
||||||
#include "kiss_fft.h"
|
#include "kiss_fft.h"
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define MAXFACTORS 32
|
#define MAXFACTORS 32
|
||||||
/* e.g. an fft of length 128 has 4 factors
|
/* e.g. an fft of length 128 has 4 factors
|
||||||
@ -37,18 +36,19 @@ struct kiss_fft_state{
|
|||||||
C_ADDTO( res , a) : res += a
|
C_ADDTO( res , a) : res += a
|
||||||
* */
|
* */
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
|
#include <stdint.h>
|
||||||
#if (FIXED_POINT==32)
|
#if (FIXED_POINT==32)
|
||||||
# define FRACBITS 31
|
# define FRACBITS 31
|
||||||
# define SAMPPROD int64_t
|
# define SAMPPROD int64_t
|
||||||
#define SAMP_MAX 2147483647
|
#define SAMP_MAX INT32_MAX
|
||||||
|
#define SAMP_MIN INT32_MIN
|
||||||
#else
|
#else
|
||||||
# define FRACBITS 15
|
# define FRACBITS 15
|
||||||
# define SAMPPROD int32_t
|
# define SAMPPROD int32_t
|
||||||
#define SAMP_MAX 32767
|
#define SAMP_MAX INT16_MAX
|
||||||
|
#define SAMP_MIN INT16_MIN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SAMP_MIN -SAMP_MAX
|
|
||||||
|
|
||||||
#if defined(CHECK_OVERFLOW)
|
#if defined(CHECK_OVERFLOW)
|
||||||
# define CHECK_OVERFLOW_OP(a,op,b) \
|
# define CHECK_OVERFLOW_OP(a,op,b) \
|
||||||
if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \
|
if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \
|
||||||
|
@ -43,7 +43,7 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
#include <sys/types.h>
|
#include <stdint.h>
|
||||||
# if (FIXED_POINT == 32)
|
# if (FIXED_POINT == 32)
|
||||||
# define kiss_fft_scalar int32_t
|
# define kiss_fft_scalar int32_t
|
||||||
# else
|
# else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user