Skip to content

Commit

Permalink
Merge pull request #13 from mike919192/conversion_warn
Browse files Browse the repository at this point in the history
Resolve conversion warnings
  • Loading branch information
mike919192 authored Apr 28, 2024
2 parents 0bd9d5a + c8fbb96 commit 4b7c67f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/sdsp/fft.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ namespace sdsp
std::array<uint, N> swapLookup {0};

for (size_t i {0}; i < N; i++) {
swapLookup.at(i) = digit_reverse<N, base>(i);
swapLookup.at(i) = digit_reverse<N, base>(static_cast<uint>(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
Expand Down
16 changes: 8 additions & 8 deletions test/testFFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TEST_CASE("FFT Radix 2 test", "[single-file]")
sdsp::complex_array<N> 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<double>(i) / N);
}

sdsp::complex_array<N> S {0};
Expand Down Expand Up @@ -52,7 +52,7 @@ TEST_CASE("FFT Radix 2 test", "[single-file]")
sdsp::complex_array<N> 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<double>(i) / N + (M_PI / 2.0));
}

sdsp::fft_radix2(s);
Expand Down Expand Up @@ -82,10 +82,10 @@ TEST_CASE("FFT Radix 2 linearity", "[single-file]")
sdsp::complex_array<N> x1 {0};
sdsp::complex_array<N> 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<double>(i))};
x1.at(i) = std::complex<double>(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<double>(i))};
x2.at(i) = std::complex<double>(value2, 0);
}

Expand Down Expand Up @@ -131,7 +131,7 @@ TEST_CASE("FFT Radix 4 test", "[single-file]")
sdsp::complex_array<N> 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<double>(i) / N);
}

sdsp::complex_array<N> S {0};
Expand Down Expand Up @@ -162,7 +162,7 @@ TEST_CASE("FFT Radix 4 test", "[single-file]")
sdsp::complex_array<N> 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<double>(i) / N + (M_PI / 2.0));
}

sdsp::fft_radix4(s);
Expand Down Expand Up @@ -192,10 +192,10 @@ TEST_CASE("FFT Radix 4 linearity", "[single-file]")
sdsp::complex_array<N> x1 {0};
sdsp::complex_array<N> 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<double>(i))};
x1.at(i) = std::complex<double>(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<double>(i))};
x2.at(i) = std::complex<double>(value2, 0);
}

Expand Down

0 comments on commit 4b7c67f

Please sign in to comment.