]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
attempt to optimize SND_PaintChannelFrom8 a little bit
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 5 Aug 2002 11:39:08 +0000 (11:39 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 5 Aug 2002 11:39:08 +0000 (11:39 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2199 d7cf8633-e32d-0410-b094-e92efae38249

snd_mix.c

index cb47d1bf2262aad832826a33eccf12f5fe870364..e9325085348f6a4582af37d1224ceb3a28792ab2 100644 (file)
--- a/snd_mix.c
+++ b/snd_mix.c
@@ -354,7 +354,7 @@ void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count)
 {
        int *lscale, *rscale;
        unsigned char *sfx;
-       int i;
+       int i, n;
 
        if (ch->leftvol > 255)
                ch->leftvol = 255;
@@ -367,22 +367,20 @@ void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count)
        {
                // LordHavoc: stereo sound support, and optimizations
                sfx = (unsigned char *)sc->data + ch->pos * 2;
-
-               for (i=0 ; i<count ; i++)
+               for (i = 0;i < count;i++)
                {
                        paintbuffer[i].left += lscale[*sfx++];
                        paintbuffer[i].right += rscale[*sfx++];
                }
-               
        }
        else
        {
                sfx = (unsigned char *)sc->data + ch->pos;
-
-               for (i=0 ; i<count ; i++)
+               for (i = 0;i < count;i++)
                {
-                       paintbuffer[i].left += lscale[*sfx];
-                       paintbuffer[i].right += rscale[*sfx++];
+                       n = *sfx++;
+                       paintbuffer[i].left += lscale[n];
+                       paintbuffer[i].right += rscale[n];
                }
 
        }