commit 60b2607

Devine Lu Linvega  ·  2026-01-13 18:15:00 +0000 UTC
parent acadc27
Use a branch in tight loop after all
1 files changed,  +4, -7
+4, -7
 1@@ -606,7 +606,7 @@ screen_deo_sprite(void)
 2 	const int addr_incr = rMA << (is_2bpp ? 2 : 1);
 3 	const int stride = screen_wmar2;
 4 	const int blend = ctrl & 0xf;
 5-	const Uint8 opaque_mask = (blend % 5) ? 0xff : 0x00;
 6+	const Uint8 opaque_mask = blend % 5;
 7 	const Uint8 *table = blend_lut[blend][layer >> 6];
 8 	for(i = 0; i <= rML; i++, x += dx, y += dy, rA += addr_incr) {
 9 		const Uint16 x0 = x + 8, y0 = y + 8;
10@@ -618,12 +618,9 @@ screen_deo_sprite(void)
11 			const int ch1 = *col, ch2 = is_2bpp ? col[8] : 0;
12 			for(int k = 0, row = row_start; k < 8; k++, d++, row += row_delta) {
13 				const int bit = 1 << row;
14-				const int color = (!!(ch1 & bit)) | (!!(ch2 & bit) << 1);
15-				const Uint8 value = *d;
16-				const Uint8 mask = opaque_mask | -(!!color);
17-				const Uint8 base = value & layer_mask;
18-				const Uint8 next = (value & ~mask) | (table[color] & mask);
19-				*d = base | next;
20+				const int color = !!(ch1 & bit) | (!!(ch2 & bit) << 1);
21+				if(opaque_mask || color)
22+					*d = (*d & layer_mask) | table[color];
23 			}
24 		}
25 	}