diff options
author | Max Kellermann <max@musicpd.org> | 2020-05-07 13:30:20 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-05-07 15:04:51 +0200 |
commit | eeec0ee804b25278ad6e39c45990cb7c12bc8e6d (patch) | |
tree | b55ef25f2c5073655332ae690630607b61a5d9eb /src/pcm | |
parent | a24ef280cc3a97736d5ef47fb7766825786d7a52 (diff) |
dsd/Dsd2Pcm: convert struct GenerateCtableValue to lambda
Since we have dropped support for GCC 6 a while ago, we can use
constexpr lambdas now.
Diffstat (limited to 'src/pcm')
-rw-r--r-- | src/pcm/Dsd2Pcm.cxx | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/pcm/Dsd2Pcm.cxx b/src/pcm/Dsd2Pcm.cxx index 4ccbfa199..b9efb3ccf 100644 --- a/src/pcm/Dsd2Pcm.cxx +++ b/src/pcm/Dsd2Pcm.cxx @@ -130,24 +130,17 @@ CalculateCtableValue(size_t t, int k, int e) noexcept return float(acc); } -/* this needs to be a struct because GCC 6 doesn't have constexpr - lambdas (C++17) */ -struct GenerateCtableValue { - size_t t; - int k; - - constexpr auto operator()(int e) const noexcept { - return CalculateCtableValue(t, k, e); - } -}; - static constexpr auto GenerateCtable(int t) noexcept { int k = HTAPS - t*8; if (k>8) k=8; - return GenerateArray<256>(GenerateCtableValue{CTABLES - 1 - t, k}); + const size_t t_ = CTABLES - 1 - t; + + return GenerateArray<256>([t_, k](int e){ + return CalculateCtableValue(t_, k, e); + }); } static constexpr auto ctables = GenerateArray<CTABLES>(GenerateCtable); |