From e602bcf41e7cbc66b7c56af8186d3821f2fc71f5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 6 Mar 2023 16:34:01 +0100 Subject: [PATCH] pcm/ReplayGainAnalyzer: remove GCC version checks, assume proper C++17 support --- src/pcm/ReplayGainAnalyzer.cxx | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/pcm/ReplayGainAnalyzer.cxx b/src/pcm/ReplayGainAnalyzer.cxx index feaa11b5f..86ba27067 100644 --- a/src/pcm/ReplayGainAnalyzer.cxx +++ b/src/pcm/ReplayGainAnalyzer.cxx @@ -64,17 +64,8 @@ Square(double x) noexcept static double SquareHypot(ReplayGainAnalyzer::Frame f) noexcept { -#if GCC_OLDER_THAN(10,0) - /* GCC 8 doesn't have std::transform_reduce() */ - double sum = 0; - for (const auto &i : f) - sum += Square(i); - return sum; -#else - /* proper C++17 */ return std::transform_reduce(f.begin(), f.end(), 0., std::plus{}, Square); -#endif } /* @@ -86,18 +77,11 @@ SquareHypot(ReplayGainAnalyzer::Frame f) noexcept static double CalcStereoRMS(std::span src) noexcept { -#if GCC_OLDER_THAN(10,0) - /* GCC 8 doesn't have std::transform_reduce() */ - double sum = 0; - for (const auto &i : src) - sum += SquareHypot(i); -#else /* proper C++17 */ double sum = std::transform_reduce(src.begin(), src.end(), 1e-16, std::plus{}, SquareHypot); -#endif return 10 * std::log10(sum / src.size()) + 90.0 - 3.0; } @@ -287,16 +271,8 @@ template static float FindHistogramPercentile95(const std::array &histogram) noexcept { -#if GCC_OLDER_THAN(10,0) - /* GCC 8 doesn't have std::reduce() */ - uint_fast32_t total_windows = 0; - for (const auto &i : histogram) - total_windows += i; -#else - /* proper C++17 */ const uint_fast32_t total_windows = std::reduce(histogram.begin(), histogram.end()); -#endif uint_fast32_t loud_count = 0; std::size_t i = histogram.size();