Commit 804ccddf authored by Max Kellermann's avatar Max Kellermann

pcm/Clamp: convert to `constexpr`

parent bb591893
......@@ -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;
......
......@@ -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));
}
};
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment