now works on platforms where int is 16 bits. e.g. Renesas M16c

This commit is contained in:
Mark Borgerding 2004-04-03 00:25:37 +00:00
parent 2457ce15ad
commit dd689e1661

View File

@ -37,17 +37,22 @@ struct kiss_fft_state{
C_ADDTO( res , a) : res += a
* */
#ifdef FIXED_POINT
# define S_MUL(a,b) ( ( (a)*(b) + (1<<14) )>>15 )
# define smul(a,b) ( (long)(a)*(b) )
# define sround( x ) (short)( ( (x) + (1<<14) ) >>15 )
# define S_MUL(a,b) sround( smul(a,b) )
# define C_MUL(m,a,b) \
do{ (m).r = ( ( (a).r*(b).r - (a).i*(b).i) + (1<<14) ) >> 15;\
(m).i = ( ( (a).r*(b).i + (a).i*(b).r) + (1<<14) ) >> 15;\
}while(0)
do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \
(m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0)
# define C_FIXDIV(c,div) \
do{ (c).r /= div; (c).i /=div; }while(0)
# define C_MULBYSCALAR( c, s ) \
do{ (c).r = ( ( (c).r*(s) ) + (1<<14) ) >> 15;\
(c).i = ( ( (c).i*(s) ) + (1<<14) ) >> 15; }while(0)
do{ (c).r = sround( smul( (c).r , s ) ) ;\
(c).i = sround( smul( (c).i , s ) ) ; }while(0)
#else /* not FIXED_POINT*/