6502: optimise the top byte check to avoid a shift
authorAlan Cox <alan@linux.intel.com>
Sun, 11 Feb 2018 21:31:00 +0000 (21:31 +0000)
committerAlan Cox <alan@linux.intel.com>
Sun, 11 Feb 2018 21:31:00 +0000 (21:31 +0000)
Kernel/cpu-6502/cpu.h

index 9c3ce28..aa10486 100644 (file)
@@ -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])