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: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@424 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2011-02-21 18:03:35 +00:00
parent 781d85bba2
commit 50d5076443

View file

@ -253,6 +253,7 @@ void SND_InitScaletable (void)
{ {
scale = i * 8 * 256 * sfxvolume.value; scale = i * 8 * 256 * sfxvolume.value;
for (j = 0; j < 256; j++) for (j = 0; j < 256; j++)
{
/* When compiling with gcc-4.1.0 at optimisations O1 and /* When compiling with gcc-4.1.0 at optimisations O1 and
higher, the tricky signed char type conversion is not higher, the tricky signed char type conversion is not
guaranteed. Therefore we explicity calculate the signed 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] = ((signed char)j) * scale;
snd_scaletable[i][j] = ((j < 128) ? j : j - 0xff) * 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]; lscale = snd_scaletable[ch->leftvol >> 3];
rscale = snd_scaletable[ch->rightvol >> 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++) for (i = 0; i < count; i++)
{ {