From: Alan Cox Date: Sun, 11 Feb 2018 21:31:00 +0000 (+0000) Subject: 6502: optimise the top byte check to avoid a shift X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=f156c03b620867134fbb3fb592bf2331b40f76e0;p=FUZIX.git 6502: optimise the top byte check to avoid a shift --- diff --git a/Kernel/cpu-6502/cpu.h b/Kernel/cpu-6502/cpu.h index 9c3ce28d..aa104865 100644 --- a/Kernel/cpu-6502/cpu.h +++ b/Kernel/cpu-6502/cpu.h @@ -65,3 +65,7 @@ typedef union { /* this structure is endian dependent */ /* cc65 really wants register tags on struct pointers used repeatedly */ #define regptr register + +/* CC65 is bright enough to partly optimise this but not fully so do it + by hand */ +#define HIBYTE32(x) (((uint8_t *)&(x))[3])