]> git.sesse.net Git - pistorm/commitdiff
optimise away an unnecessary subtract on the instruction fetch fast path
authorRune Holm <rune.holm@gmail.com>
Fri, 18 Jun 2021 18:51:46 +0000 (19:51 +0100)
committerRune Holm <rune.holm@gmail.com>
Fri, 18 Jun 2021 21:01:20 +0000 (22:01 +0100)
m68kcpu.c
m68kcpu.h

index da84aed0067dc887330ceae83e1185e279f45a0d..bdcb1039fa9c9801ef6ffb74b3595c2a61617814 100644 (file)
--- a/m68kcpu.c
+++ b/m68kcpu.c
@@ -1265,7 +1265,7 @@ uint m68ki_read_imm6_addr_slowpath(uint32_t pc, address_translation_cache *cache
                if(address >= read_addr[i] && address < read_upper[i]) {
             cache->lower = read_addr[i] + pc_address_diff;
             cache->upper = read_upper[i] + pc_address_diff;
-            cache->data = read_data[i];
+            cache->offset = read_data[i] - cache->lower;
                        REG_PC += 2;
                        return be16toh(((unsigned short *)(read_data[i] + (address - read_addr[i])))[0]);
                }
index ef25ad1b156343911527f76d189f0f8e9c4a73f9..d943f94c40a279a551294222ebe70aa7b6edda5b 100644 (file)
--- a/m68kcpu.h
+++ b/m68kcpu.h
@@ -1079,7 +1079,7 @@ typedef struct
 {
     unsigned int lower;
     unsigned int upper;
-    unsigned char *data;
+    unsigned char *offset;
 } address_translation_cache;
 
 
@@ -1173,7 +1173,7 @@ static inline uint m68ki_read_imm_16(void)
     if(pc >= cache->lower && pc < cache->upper)
     {
         REG_PC += 2;
-        return be16toh(((unsigned short *)(cache->data + (pc - cache->lower)))[0]);
+        return be16toh(((unsigned short *)(cache->offset + pc))[0]);
     }
     return m68ki_read_imm6_addr_slowpath(pc, cache);
 }