From 8d388411b00a89d76fccf60abe1b2c5ccc2897c4 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Mon, 3 Oct 2016 20:58:22 +0200 Subject: [PATCH] src/spectral/ooura_fft8g.c: add cast to avoid conversion warnings --- src/spectral/ooura_fft8g.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/spectral/ooura_fft8g.c b/src/spectral/ooura_fft8g.c index 802e48a5..394bea08 100644 --- a/src/spectral/ooura_fft8g.c +++ b/src/spectral/ooura_fft8g.c @@ -2,7 +2,8 @@ // - replace all 'double' with 'smpl_t' // - include "aubio_priv.h" (for config.h and types.h) // - add missing prototypes -// - use COS and SIN macros +// - use COS, SIN, and ATAN macros +// - add cast to (smpl_t) to avoid float conversion warnings // - declare initialization as static // - prefix public function with aubio_ooura_ @@ -363,7 +364,7 @@ void aubio_ooura_rdft(int n, int isgn, smpl_t *a, int *ip, smpl_t *w) a[0] += a[1]; a[1] = xi; } else { - a[1] = 0.5 * (a[0] - a[1]); + a[1] = (smpl_t)0.5 * (a[0] - a[1]); a[0] -= a[1]; if (n > 4) { rftbsub(n, a, nc, w + nw); @@ -692,7 +693,7 @@ void makewt(int nw, int *ip, smpl_t *w) ip[1] = 1; if (nw > 2) { nwh = nw >> 1; - delta = atan(1.0) / nwh; + delta = ATAN(1.0) / nwh; w[0] = 1; w[1] = 0; w[nwh] = COS(delta * nwh); @@ -726,12 +727,12 @@ void makect(int nc, int *ip, smpl_t *c) ip[1] = nc; if (nc > 1) { nch = nc >> 1; - delta = atan(1.0) / nch; - c[0] = cos(delta * nch); - c[nch] = 0.5 * c[0]; + delta = ATAN(1.0) / nch; + c[0] = COS(delta * nch); + c[nch] = (smpl_t)0.5 * c[0]; for (j = 1; j < nch; j++) { - c[j] = 0.5 * cos(delta * j); - c[nc - j] = 0.5 * sin(delta * j); + c[j] = (smpl_t)0.5 * COS(delta * j); + c[nc - j] = (smpl_t)0.5 * SIN(delta * j); } } } @@ -1587,7 +1588,7 @@ void rftfsub(int n, smpl_t *a, int nc, smpl_t *c) for (j = 2; j < m; j += 2) { k = n - j; kk += ks; - wkr = 0.5 - c[nc - kk]; + wkr = (smpl_t)0.5 - c[nc - kk]; wki = c[kk]; xr = a[j] - a[k]; xi = a[j + 1] + a[k + 1]; @@ -1613,7 +1614,7 @@ void rftbsub(int n, smpl_t *a, int nc, smpl_t *c) for (j = 2; j < m; j += 2) { k = n - j; kk += ks; - wkr = 0.5 - c[nc - kk]; + wkr = (smpl_t)0.5 - c[nc - kk]; wki = c[kk]; xr = a[j] - a[k]; xi = a[j + 1] + a[k + 1]; -- 2.11.0