commit acadc27

Devine Lu Linvega  ·  2026-01-13 17:32:42 +0000 UTC
parent 6a52595
Removed a useless shift in sprite loop
1 files changed,  +8, -5
+8, -5
 1@@ -614,13 +614,16 @@ screen_deo_sprite(void)
 2 		Uint8 *dst = screen_layers + y0 * stride + x0;
 3 		const Uint8 *col = &ram[rA + col_start];
 4 		for(j = 0; j < 8; j++, dst += stride, col += col_delta) {
 5-			const int ch1 = *col, ch2 = is_2bpp ? (col[8] << 1) : 0;
 6 			Uint8 *d = dst;
 7+			const int ch1 = *col, ch2 = is_2bpp ? col[8] : 0;
 8 			for(int k = 0, row = row_start; k < 8; k++, d++, row += row_delta) {
 9 				const int bit = 1 << row;
10-				const int color = ((ch1 & bit) ? 1 : 0) | ((ch2 & (bit << 1)) ? 2 : 0);
11-				const Uint8 mask = -(!!(color | opaque_mask));
12-				*d = (*d & ~mask) | (((*d & layer_mask) | table[color]) & mask);
13+				const int color = (!!(ch1 & bit)) | (!!(ch2 & bit) << 1);
14+				const Uint8 value = *d;
15+				const Uint8 mask = opaque_mask | -(!!color);
16+				const Uint8 base = value & layer_mask;
17+				const Uint8 next = (value & ~mask) | (table[color] & mask);
18+				*d = base | next;
19 			}
20 		}
21 	}
22@@ -1316,7 +1319,7 @@ main(int argc, char **argv)
23 {
24 	int i = 1;
25 	if(argc == 2 && argv[1][0] == '-' && argv[1][1] == 'v')
26-		return !fprintf(stdout, "%s - Varvara Emulator, 11 Jan 2026.\n", argv[0]);
27+		return !fprintf(stdout, "%s - Varvara Emulator, 13 Jan 2026.\n", argv[0]);
28 	else if(argc == 1)
29 		return !fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]);
30 	else if(!system_boot(argv[i++], argc > 2))