summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-10-30 00:06:48 +0100
committerMax Kellermann <max@musicpd.org>2018-10-30 00:08:25 +0100
commit804ccddf7e08b7bac5121ed2b6f8c7fb9e5f3ed6 (patch)
treed9b0db3eec9337939908bf06cfd0b408a37dba5e /src
parentbb5918932b900a42a413fee5d4764446f5ab2669 (diff)
pcm/Clamp: convert to `constexpr`
Diffstat (limited to 'src')
-rw-r--r--src/pcm/Clamp.hxx3
-rw-r--r--src/pcm/FloatConvert.hxx3
-rw-r--r--src/pcm/PcmMix.cxx2
3 files changed, 3 insertions, 5 deletions
diff --git a/src/pcm/Clamp.hxx b/src/pcm/Clamp.hxx
index 2461ba2a9..6d94f3b7c 100644
--- a/src/pcm/Clamp.hxx
+++ b/src/pcm/Clamp.hxx
@@ -34,8 +34,7 @@ template<SampleFormat F> struct SampleTraits;
* and caps it if necessary.
*/
template<SampleFormat F, class Traits=SampleTraits<F>>
-gcc_const
-static inline typename Traits::value_type
+constexpr typename Traits::value_type
PcmClamp(typename Traits::long_type x) noexcept
{
typedef typename Traits::value_type T;
diff --git a/src/pcm/FloatConvert.hxx b/src/pcm/FloatConvert.hxx
index 8f77227ec..1fa275427 100644
--- a/src/pcm/FloatConvert.hxx
+++ b/src/pcm/FloatConvert.hxx
@@ -37,8 +37,7 @@ struct FloatToIntegerSampleConvert {
static constexpr SV factor = uintmax_t(1) << (DstTraits::BITS - 1);
static_assert(factor > 0, "Wrong factor");
- gcc_const
- static DV Convert(SV src) noexcept {
+ static constexpr DV Convert(SV src) noexcept {
return PcmClamp<F, Traits>(SL(src * factor));
}
};
diff --git a/src/pcm/PcmMix.cxx b/src/pcm/PcmMix.cxx
index 09b374b9b..bbbf0c3ec 100644
--- a/src/pcm/PcmMix.cxx
+++ b/src/pcm/PcmMix.cxx
@@ -134,7 +134,7 @@ pcm_add_vol(PcmDither &dither, void *buffer1, const void *buffer2, size_t size,
}
template<SampleFormat F, class Traits=SampleTraits<F>>
-static typename Traits::value_type
+static constexpr typename Traits::value_type
PcmAdd(typename Traits::value_type _a, typename Traits::value_type _b) noexcept
{
typename Traits::sum_type a(_a), b(_b);