]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_mix.c
attempt to optimize SND_PaintChannelFrom8 a little bit
[xonotic/darkplaces.git] / 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];
                }
 
        }