aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/mp3_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:13 +0200
committerEric Wong <normalperson@yhbt.net>2008-08-30 19:47:28 -0700
commitdcd1a83a07d918f1fc69d2062a6be9f1aa396659 (patch)
tree6557305dd0000945de6fdbd582c7d7eea33fb8b2 /src/inputPlugins/mp3_plugin.c
parentf4f318fcffe454b4c74bb66a674b016f9ac501f3 (diff)
downloadmpd-dcd1a83a07d918f1fc69d2062a6be9f1aa396659.tar.gz
mpd-dcd1a83a07d918f1fc69d2062a6be9f1aa396659.tar.xz
mpd-dcd1a83a07d918f1fc69d2062a6be9f1aa396659.zip
mp3: audio_linear_dither() returns mpd_sint16
The return value of audio_linear_dither() is always casted to mpd_sint16. Returning long does not make sense, and consumed 8 bytes on a 64 bit platform.
Diffstat (limited to '')
-rw-r--r--src/inputPlugins/mp3_plugin.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c
index 46b0a875c..a39b0d128 100644
--- a/src/inputPlugins/mp3_plugin.c
+++ b/src/inputPlugins/mp3_plugin.c
@@ -60,8 +60,8 @@ static unsigned long prng(unsigned long state)
return (state * 0x0019660dL + 0x3c6ef35fL) & 0xffffffffL;
}
-static signed long audio_linear_dither(unsigned int bits, mad_fixed_t sample,
- struct audio_dither *dither)
+static mpd_sint16 audio_linear_dither(unsigned int bits, mad_fixed_t sample,
+ struct audio_dither *dither)
{
unsigned int scalebits;
mad_fixed_t output, mask, rnd;
@@ -102,7 +102,7 @@ static signed long audio_linear_dither(unsigned int bits, mad_fixed_t sample,
dither->error[0] = sample - output;
- return output >> scalebits;
+ return (mpd_sint16)(output >> scalebits);
}
static unsigned dither_buffer(mpd_sint16 *dest0, const struct mad_synth *synth,
@@ -114,16 +114,14 @@ static unsigned dither_buffer(mpd_sint16 *dest0, const struct mad_synth *synth,
unsigned int i;
for (i = start; i < end; ++i) {
- *dest++ = (mpd_sint16)
- audio_linear_dither(16,
- synth->pcm.samples[0][i],
- dither);
+ *dest++ = audio_linear_dither(16,
+ synth->pcm.samples[0][i],
+ dither);
if (num_channels == 2)
- *dest++ = (mpd_sint16)
- audio_linear_dither(16,
- synth->pcm.samples[1][i],
- dither);
+ *dest++ = audio_linear_dither(16,
+ synth->pcm.samples[1][i],
+ dither);
}
return dest - dest0;