PcmDither: use constexpr

This commit is contained in:
Max Kellermann 2013-01-31 22:55:00 +01:00
parent f2491c88c8
commit eab78ab99c

View File

@ -24,16 +24,14 @@
inline int16_t inline int16_t
PcmDither::Dither24To16(int_fast32_t sample) PcmDither::Dither24To16(int_fast32_t sample)
{ {
enum { constexpr unsigned from_bits = 24;
from_bits = 24, constexpr unsigned to_bits = 16;
to_bits = 16, constexpr unsigned scale_bits = from_bits - to_bits;
scale_bits = from_bits - to_bits, constexpr int_fast32_t round = 1 << (scale_bits - 1);
round = 1 << (scale_bits - 1), constexpr int_fast32_t mask = (1 << scale_bits) - 1;
mask = (1 << scale_bits) - 1, constexpr int_fast32_t ONE = 1 << (from_bits - 1);
ONE = 1 << (from_bits - 1), constexpr int_fast32_t MIN = -ONE;
MIN = -ONE, constexpr int_fast32_t MAX = ONE - 1;
MAX = ONE - 1
};
sample += error[0] - error[1] + error[2]; sample += error[0] - error[1] + error[2];