From f156c03b620867134fbb3fb592bf2331b40f76e0 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 11 Feb 2018 21:31:00 +0000 Subject: [PATCH] 6502: optimise the top byte check to avoid a shift --- Kernel/cpu-6502/cpu.h | 4 ++++ 1 file changed, 4 insertions(+) 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]) -- 2.34.1