diff options
author | Chris Robinson <[email protected]> | 2023-10-10 16:33:09 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-10-10 16:33:09 -0700 |
commit | ce25165944913c12b9b782e40691f3be1d18dadd (patch) | |
tree | 66083169e68238c912f7dbe60094641ebb39f629 | |
parent | 9274190020659369ef0734d6314d9f89cce889b0 (diff) |
Fix conversion warnings
-rw-r--r-- | common/pffft.cpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/common/pffft.cpp b/common/pffft.cpp index c01c8988..7e5ba5c3 100644 --- a/common/pffft.cpp +++ b/common/pffft.cpp @@ -1310,23 +1310,24 @@ void rffti1_ps(const uint n, float *wa, const al::span<uint,15> ifac) size_t is{0}; size_t nfm1{nf - 1}; size_t l1{1}; - for(size_t k1{1};k1 <= nfm1;++k1) + for(size_t k1{0};k1 < nfm1;++k1) { - const size_t ip{ifac[k1 + 1]}; + const size_t ip{ifac[k1+2]}; const size_t l2{l1*ip}; const size_t ido{n / l2}; const size_t ipm{ip - 1}; - int ld{0}; - for(size_t j{1};j <= ipm;++j) + size_t ld{0}; + for(size_t j{0};j < ipm;++j) { - size_t i{is}, fi{0}; + size_t i{is}; ld += l1; - double argld{ld*argh}; - for(size_t ii{3};ii <= ido;ii += 2) + const double argld{static_cast<double>(ld)*argh}; + double fi{0.0}; + for(size_t ii{2};ii < ido;ii += 2) { - fi += 1; - wa[i++] = static_cast<float>(std::cos(static_cast<double>(fi)*argld)); - wa[i++] = static_cast<float>(std::sin(static_cast<double>(fi)*argld)); + fi += 1.0; + wa[i++] = static_cast<float>(std::cos(fi*argld)); + wa[i++] = static_cast<float>(std::sin(fi*argld)); } is += ido; } @@ -1342,26 +1343,27 @@ void cffti1_ps(const uint n, float *wa, const al::span<uint,15> ifac) const double argh{2.0*al::numbers::pi / n}; size_t i{1}; size_t l1{1}; - for(size_t k1{1};k1 <= nf;++k1) + for(size_t k1{0};k1 < nf;++k1) { - const size_t ip{ifac[k1+1]}; + const size_t ip{ifac[k1+2]}; const size_t l2{l1*ip}; const size_t ido{n / l2}; const size_t idot{ido + ido + 2}; const size_t ipm{ip - 1}; size_t ld{0}; - for(size_t j{1};j <= ipm;++j) + for(size_t j{0};j < ipm;++j) { - size_t i1{i}, fi{0}; + size_t i1{i}; wa[i-1] = 1; wa[i] = 0; ld += l1; - const double argld{ld*argh}; - for(size_t ii{4};ii <= idot;ii += 2) + const double argld{static_cast<double>(ld)*argh}; + double fi{0.0}; + for(size_t ii{3};ii < idot;ii += 2) { - fi += 1; - wa[++i] = static_cast<float>(std::cos(static_cast<double>(fi)*argld)); - wa[++i] = static_cast<float>(std::sin(static_cast<double>(fi)*argld)); + fi += 1.0; + wa[++i] = static_cast<float>(std::cos(fi*argld)); + wa[++i] = static_cast<float>(std::sin(fi*argld)); } if(ip > 5) { |