commit 05d9405e7a6a1e9cbc1dd76aecc36c66e7891a87
parent f14f8a64f4122002318d3f94a6cbfd2da53de0fd
Author: neauoire <aliceffekt@gmail.com>
Date: Sat, 10 Apr 2021 09:32:14 -0700
Microscopic optimizations
Diffstat:
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/emulator.c b/src/emulator.c
@@ -214,8 +214,8 @@ screen_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1)
Uint16 x = mempeek16(u, ptr + 8);
Uint16 y = mempeek16(u, ptr + 10);
Uint8 *addr = &u->ram.dat[mempeek16(u, ptr + 12)];
- Uint8 *layer = (b1 >> 4 & 0xf) % 2 ? ppu.fg : ppu.bg;
- switch((b1 >> 4) / 2) {
+ Uint8 *layer = b1 >> 4 & 0x1 ? ppu.fg : ppu.bg;
+ switch(b1 >> 5) {
case 0: putpixel(&ppu, layer, x, y, b1 & 0x3); break;
case 1: puticn(&ppu, layer, x, y, addr, b1 & 0xf); break;
case 2: putchr(&ppu, layer, x, y, addr, b1 & 0xf); break;
diff --git a/src/ppu.h b/src/ppu.h
@@ -3,6 +3,7 @@
/*
Copyright (c) 2021 Devine Lu Linvega
+Copyright (c) 2021 Andrew Alderwick
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above