diff --git a/include/sdsp/fft.h b/include/sdsp/fft.h index 7b50368..9540de0 100644 --- a/include/sdsp/fft.h +++ b/include/sdsp/fft.h @@ -209,7 +209,7 @@ namespace sdsp std::array swapLookup {0}; for (size_t i {0}; i < N; i++) { - swapLookup.at(i) = digit_reverse(i); + swapLookup.at(i) = digit_reverse(static_cast(i)); } //then go through one more time and for every pair, unreverse the one with the higher index //this prevents the swap from occuring twice, which would undo the swap diff --git a/test/testFFT.cpp b/test/testFFT.cpp index 2081765..5e72d63 100644 --- a/test/testFFT.cpp +++ b/test/testFFT.cpp @@ -21,7 +21,7 @@ TEST_CASE("FFT Radix 2 test", "[single-file]") sdsp::complex_array s {0}; for (size_t i = 0; i < s.size(); i++) { - s.at(i) = std::cos(n * 2 * M_PI * i / N); + s.at(i) = std::cos(n * 2 * M_PI * static_cast(i) / N); } sdsp::complex_array S {0}; @@ -52,7 +52,7 @@ TEST_CASE("FFT Radix 2 test", "[single-file]") sdsp::complex_array s2 {0}; for (size_t i {0}; i < s2.size(); i++) { - s2.at(i) = std::cos(n * 2 * M_PI * i / N + (M_PI / 2.0)); + s2.at(i) = std::cos(n * 2 * M_PI * static_cast(i) / N + (M_PI / 2.0)); } sdsp::fft_radix2(s); @@ -82,10 +82,10 @@ TEST_CASE("FFT Radix 2 linearity", "[single-file]") sdsp::complex_array x1 {0}; sdsp::complex_array x2 {0}; for (size_t i {0}; i < x1.size(); i++) { - double value {std::sin(2.0 * M_PI * freq1 * (1.0 / fs) * i)}; + double value {std::sin(2.0 * M_PI * freq1 * (1.0 / fs) * static_cast(i))}; x1.at(i) = std::complex(value, 0); - double value2 {std::sin(2.0 * M_PI * freq2 * (1.0 / fs) * i)}; + double value2 {std::sin(2.0 * M_PI * freq2 * (1.0 / fs) * static_cast(i))}; x2.at(i) = std::complex(value2, 0); } @@ -131,7 +131,7 @@ TEST_CASE("FFT Radix 4 test", "[single-file]") sdsp::complex_array s {0}; for (size_t i {0}; i < s.size(); i++) { - s.at(i) = std::cos(n * 2 * M_PI * i / N); + s.at(i) = std::cos(n * 2 * M_PI * static_cast(i) / N); } sdsp::complex_array S {0}; @@ -162,7 +162,7 @@ TEST_CASE("FFT Radix 4 test", "[single-file]") sdsp::complex_array s2 {0}; for (size_t i {0}; i < s2.size(); i++) { - s2.at(i) = std::cos(n * 2 * M_PI * i / N + (M_PI / 2.0)); + s2.at(i) = std::cos(n * 2 * M_PI * static_cast(i) / N + (M_PI / 2.0)); } sdsp::fft_radix4(s); @@ -192,10 +192,10 @@ TEST_CASE("FFT Radix 4 linearity", "[single-file]") sdsp::complex_array x1 {0}; sdsp::complex_array x2 {0}; for (size_t i {0}; i < x1.size(); i++) { - double value {std::sin(2.0 * M_PI * freq1 * (1.0 / fs) * i)}; + double value {std::sin(2.0 * M_PI * freq1 * (1.0 / fs) * static_cast(i))}; x1.at(i) = std::complex(value, 0); - double value2 {std::sin(2.0 * M_PI * freq2 * (1.0 / fs) * i)}; + double value2 {std::sin(2.0 * M_PI * freq2 * (1.0 / fs) * static_cast(i))}; x2.at(i) = std::complex(value2, 0); }