summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-08-03 00:26:36 +0200
committerMax Kellermann <max@musicpd.org>2019-08-03 00:27:59 +0200
commitf7ed7446ae4be9226de554d6d75a14a9fb71dd7c (patch)
tree2d94335ad98cca4afb3a426ce984623bccdc1525 /src
parent9d44a6d2ae7df74085210c4fc8c7cf1f617a65e5 (diff)
decoder/mad: use MAD_F_MIN and MAD_F_MAX
Diffstat (limited to 'src')
-rw-r--r--src/decoder/plugins/MadDecoderPlugin.cxx4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/decoder/plugins/MadDecoderPlugin.cxx b/src/decoder/plugins/MadDecoderPlugin.cxx
index bc7ed3e39..5a9490bcb 100644
--- a/src/decoder/plugins/MadDecoderPlugin.cxx
+++ b/src/decoder/plugins/MadDecoderPlugin.cxx
@@ -79,14 +79,12 @@ static inline int32_t
mad_fixed_to_24_sample(mad_fixed_t sample)
{
static constexpr unsigned bits = 24;
- static constexpr mad_fixed_t MIN = -MAD_F_ONE;
- static constexpr mad_fixed_t MAX = MAD_F_ONE - 1;
/* round */
sample = sample + (1L << (MAD_F_FRACBITS - bits));
/* quantize */
- return Clamp(sample, MIN, MAX)
+ return Clamp(sample, MAD_F_MIN, MAD_F_MAX)
>> (MAD_F_FRACBITS + 1 - bits);
}