Merge branch 'v0.20.x'

This commit is contained in:
Max Kellermann
2018-10-29 23:06:32 +01:00
5 changed files with 14 additions and 16 deletions
+4 -2
View File
@@ -34,7 +34,8 @@ struct FloatToIntegerSampleConvert {
typedef typename SrcTraits::long_type SL;
typedef typename DstTraits::value_type DV;
static constexpr SV factor = 1 << (DstTraits::BITS - 1);
static constexpr SV factor = uintmax_t(1) << (DstTraits::BITS - 1);
static_assert(factor > 0, "Wrong factor");
gcc_const
static DV Convert(SV src) noexcept {
@@ -53,7 +54,8 @@ struct IntegerToFloatSampleConvert {
typedef typename SrcTraits::value_type SV;
typedef typename DstTraits::value_type DV;
static constexpr DV factor = 0.5 / (1 << (SrcTraits::BITS - 2));
static constexpr DV factor = 1.0 / FloatToIntegerSampleConvert<F, Traits>::factor;
static_assert(factor > 0, "Wrong factor");
gcc_const
static DV Convert(SV src) noexcept {