diff options
| author | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2023-05-06 16:22:03 +0300 |
|---|---|---|
| committer | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2023-05-06 16:22:03 +0300 |
| commit | 3bd76ba574e9a3da89600e85c6c35bcb005a1317 (patch) | |
| tree | e2403787b74bb7f32e2e7307cb41f8d21249df98 | |
| parent | 2131e23c0422bb4c05ddaba73eb692ad97217a53 (diff) | |
Fix compilation issues.
| -rw-r--r-- | src/fft.cpp | 9 | ||||
| -rw-r--r-- | src/input-parser.cpp | 32 |
2 files changed, 21 insertions, 20 deletions
diff --git a/src/fft.cpp b/src/fft.cpp index d5fa4c2..5668ac8 100644 --- a/src/fft.cpp +++ b/src/fft.cpp @@ -11,6 +11,7 @@ #include <cstring> #include <cmath> #include <complex> +#include <limits> static double sinc(double x) @@ -25,11 +26,11 @@ sinc(double x) } else { double result = 1.0f; - if (abs(x) >= taylor_0_bound) { + if (std::abs(x) >= taylor_0_bound) { double x2 = x * x; result -= x2 / 6.0f; - if (abs(x) >= taylor_2_bound) { + if (std::abs(x) >= taylor_2_bound) { result += (x2 * x2) / 120.0f; } } @@ -239,8 +240,8 @@ FFT::Crop(const RealWindow& input, double rate, double fmin, double fmax) double di_fmax = std::round(FFT::GetFrequencyIndex(rate, input.size(), fmax)); /* we're cropping, so no interpolation allowed */ - auto i_fmin = static_cast<std::int64_t>(di_fmin); - auto i_fmax = static_cast<std::int64_t>(di_fmax); + auto i_fmin = static_cast<int64_t>(di_fmin); + auto i_fmax = static_cast<int64_t>(di_fmax); if (i_fmin < 0) { throw std::runtime_error("fmin outside of window"); diff --git a/src/input-parser.cpp b/src/input-parser.cpp index 677aa48..f9ad73b 100644 --- a/src/input-parser.cpp +++ b/src/input-parser.cpp @@ -41,21 +41,21 @@ std::unique_ptr<InputParser> InputParser::Build(DataType dtype, double prescale, bool is_complex) { if (dtype == DataType::kSignedInt8) { - return std::make_unique<IntegerInputParser<std::int8_t>>(prescale, is_complex); + return std::make_unique<IntegerInputParser<int8_t>>(prescale, is_complex); } else if (dtype == DataType::kSignedInt16) { - return std::make_unique<IntegerInputParser<std::int16_t>>(prescale, is_complex); + return std::make_unique<IntegerInputParser<int16_t>>(prescale, is_complex); } else if (dtype == DataType::kSignedInt32) { - return std::make_unique<IntegerInputParser<std::int32_t>>(prescale, is_complex); + return std::make_unique<IntegerInputParser<int32_t>>(prescale, is_complex); } else if (dtype == DataType::kSignedInt64) { - return std::make_unique<IntegerInputParser<std::int64_t>>(prescale, is_complex); + return std::make_unique<IntegerInputParser<int64_t>>(prescale, is_complex); } else if (dtype == DataType::kUnsignedInt8) { - return std::make_unique<IntegerInputParser<std::uint8_t>>(prescale, is_complex); + return std::make_unique<IntegerInputParser<int8_t>>(prescale, is_complex); } else if (dtype == DataType::kUnsignedInt16) { - return std::make_unique<IntegerInputParser<std::uint16_t>>(prescale, is_complex); + return std::make_unique<IntegerInputParser<int16_t>>(prescale, is_complex); } else if (dtype == DataType::kUnsignedInt32) { - return std::make_unique<IntegerInputParser<std::uint32_t>>(prescale, is_complex); + return std::make_unique<IntegerInputParser<int32_t>>(prescale, is_complex); } else if (dtype == DataType::kUnsignedInt64) { - return std::make_unique<IntegerInputParser<std::uint64_t>>(prescale, is_complex); + return std::make_unique<IntegerInputParser<int64_t>>(prescale, is_complex); } else if (dtype == DataType::kFloat32) { return std::make_unique<FloatInputParser<float>>(prescale, is_complex); } else if (dtype == DataType::kFloat64) { @@ -152,15 +152,15 @@ FloatInputParser<T>::ParseBlock(const std::vector<char> &block) return count; } -template class IntegerInputParser<std::uint8_t>; -template class IntegerInputParser<std::uint16_t>; -template class IntegerInputParser<std::uint32_t>; -template class IntegerInputParser<std::uint64_t>; +template class IntegerInputParser<int8_t>; +template class IntegerInputParser<int16_t>; +template class IntegerInputParser<int32_t>; +template class IntegerInputParser<int64_t>; -template class IntegerInputParser<std::int8_t>; -template class IntegerInputParser<std::int16_t>; -template class IntegerInputParser<std::int32_t>; -template class IntegerInputParser<std::int64_t>; +template class IntegerInputParser<uint8_t>; +template class IntegerInputParser<uint16_t>; +template class IntegerInputParser<uint32_t>; +template class IntegerInputParser<uint64_t>; template class FloatInputParser<float>; template class FloatInputParser<double>; |
