From 9a1bdc313744972d4bbf104471f9a744d1e8a220 Mon Sep 17 00:00:00 2001 From: sezero Date: Mon, 21 Feb 2011 18:03:35 +0000 Subject: [PATCH] snd_mix.c, minor cleanup: eliminated stupid multiple casting in SND_PaintChannelFrom8(), added braces to the inner for loop in SND_InitScaletable(). git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@424 af15c1b1-3010-417e-b628-4374ebc0bcbd --- quakespasm/Quake/snd_mix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/quakespasm/Quake/snd_mix.c b/quakespasm/Quake/snd_mix.c index 4e28039a..d1e1292c 100644 --- a/quakespasm/Quake/snd_mix.c +++ b/quakespasm/Quake/snd_mix.c @@ -253,6 +253,7 @@ void SND_InitScaletable (void) { scale = i * 8 * 256 * sfxvolume.value; for (j = 0; j < 256; j++) + { /* When compiling with gcc-4.1.0 at optimisations O1 and higher, the tricky signed char type conversion is not guaranteed. Therefore we explicity calculate the signed @@ -261,6 +262,7 @@ void SND_InitScaletable (void) */ // snd_scaletable[i][j] = ((signed char)j) * scale; snd_scaletable[i][j] = ((j < 128) ? j : j - 0xff) * scale; + } } } @@ -279,7 +281,7 @@ static void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count) lscale = snd_scaletable[ch->leftvol >> 3]; rscale = snd_scaletable[ch->rightvol >> 3]; - sfx = (unsigned char *) ((signed char *)sc->data + ch->pos); + sfx = (unsigned char *)sc->data + ch->pos; for (i = 0; i < count; i++) {