Skip to content

Commit

Permalink
Include stdint.h only where fixed point types are used. Use min/max v…
Browse files Browse the repository at this point in the history
…alues from stdint.h.
  • Loading branch information
Jason Heeris committed Apr 5, 2019
1 parent a75f084 commit d1f9113
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions _kiss_fft_guts.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */
#include "kiss_fft.h"
#include <limits.h>
#include <stdint.h>

#define MAXFACTORS 32
/* e.g. an fft of length 128 has 4 factors
Expand All @@ -37,18 +36,19 @@ struct kiss_fft_state{
C_ADDTO( res , a) : res += a
* */
#ifdef FIXED_POINT
#include <stdint.h>
#if (FIXED_POINT==32)
# define FRACBITS 31
# define SAMPPROD int64_t
#define SAMP_MAX 2147483647
#define SAMP_MAX INT32_MAX
#define SAMP_MIN INT32_MIN
#else
# define FRACBITS 15
# define SAMPPROD int32_t
#define SAMP_MAX 32767
# define SAMPPROD int32_t
#define SAMP_MAX INT16_MAX
#define SAMP_MIN INT16_MIN
#endif

#define SAMP_MIN -SAMP_MAX

#if defined(CHECK_OVERFLOW)
# define CHECK_OVERFLOW_OP(a,op,b) \
if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \
Expand Down
2 changes: 1 addition & 1 deletion kiss_fft.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ extern "C" {


#ifdef FIXED_POINT
#include <sys/types.h>
#include <stdint.h>
# if (FIXED_POINT == 32)
# define kiss_fft_scalar int32_t
# else
Expand Down

0 comments on commit d1f9113

Please sign in to comment.