[sw] Remove hand loop unrolling from pic and conback

GCC has done a better job for about twenty years. Readability for the
win :).
This commit is contained in:
Bill Currie 2023-01-17 11:31:46 +09:00
parent 31c1420682
commit 96c82106f9

View file

@ -526,38 +526,13 @@ Draw_Pic (int x, int y, qpic_t *pic)
dest = d_viewbuffer + y * d_rowbytes + x;
if (pic->width & 7) { // general
for (v = 0; v < pic->height; v++) {
for (u = 0; u < pic->width; u++)
if ((tbyte = source[u]) != TRANSPARENT_COLOR)
dest[u] = tbyte;
for (v = 0; v < pic->height; v++) {
for (u = 0; u < pic->width; u++)
if ((tbyte = source[u]) != TRANSPARENT_COLOR)
dest[u] = tbyte;
dest += d_rowbytes;
source += pic->width;
}
} else { // unwound
for (v = 0; v < pic->height; v++) {
for (u = 0; u < pic->width; u += 8) {
if ((tbyte = source[u]) != TRANSPARENT_COLOR)
dest[u] = tbyte;
if ((tbyte = source[u + 1]) != TRANSPARENT_COLOR)
dest[u + 1] = tbyte;
if ((tbyte = source[u + 2]) != TRANSPARENT_COLOR)
dest[u + 2] = tbyte;
if ((tbyte = source[u + 3]) != TRANSPARENT_COLOR)
dest[u + 3] = tbyte;
if ((tbyte = source[u + 4]) != TRANSPARENT_COLOR)
dest[u + 4] = tbyte;
if ((tbyte = source[u + 5]) != TRANSPARENT_COLOR)
dest[u + 5] = tbyte;
if ((tbyte = source[u + 6]) != TRANSPARENT_COLOR)
dest[u + 6] = tbyte;
if ((tbyte = source[u + 7]) != TRANSPARENT_COLOR)
dest[u + 7] = tbyte;
}
dest += d_rowbytes;
source += pic->width;
}
dest += d_rowbytes;
source += pic->width;
}
}
@ -660,15 +635,9 @@ Draw_ConsoleBackground (int lines, byte alpha)
else {
f = 0;
fstep = 320 * 0x10000 / vid.width;
for (unsigned x = 0; x < vid.width; x += 4) {
for (unsigned x = 0; x < vid.width; x++) {
dest[x] = src[f >> 16];
f += fstep;
dest[x + 1] = src[f >> 16];
f += fstep;
dest[x + 2] = src[f >> 16];
f += fstep;
dest[x + 3] = src[f >> 16];
f += fstep;
}
}
}