Browse code

Microscopic optimizations

neauoire authored on 10/04/2021 16:32:14
Showing 2 changed files
... ...
@@ -214,8 +214,8 @@ screen_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1)
214 214
 		Uint16 x = mempeek16(u, ptr + 8);
215 215
 		Uint16 y = mempeek16(u, ptr + 10);
216 216
 		Uint8 *addr = &u->ram.dat[mempeek16(u, ptr + 12)];
217
-		Uint8 *layer = (b1 >> 4 & 0xf) % 2 ? ppu.fg : ppu.bg;
218
-		switch((b1 >> 4) / 2) {
217
+		Uint8 *layer = b1 >> 4 & 0x1 ? ppu.fg : ppu.bg;
218
+		switch(b1 >> 5) {
219 219
 		case 0: putpixel(&ppu, layer, x, y, b1 & 0x3); break;
220 220
 		case 1: puticn(&ppu, layer, x, y, addr, b1 & 0xf); break;
221 221
 		case 2: putchr(&ppu, layer, x, y, addr, b1 & 0xf); break;
... ...
@@ -3,6 +3,7 @@
3 3
 
4 4
 /*
5 5
 Copyright (c) 2021 Devine Lu Linvega
6
+Copyright (c) 2021 Andrew Alderwick
6 7
 
7 8
 Permission to use, copy, modify, and distribute this software for any
8 9
 purpose with or without fee is hereby granted, provided that the above