All: Faster memory read/write

This commit is contained in:
Jeffrey Pfau 2016-07-30 00:51:45 -07:00
parent 012c70a0ce
commit 42f5934b25
3 changed files with 8 additions and 7 deletions

View File

@ -27,6 +27,7 @@ Misc:
- 3DS: Port to using citro3D - 3DS: Port to using citro3D
- 3DS: Use system font for menus - 3DS: Use system font for menus
- PSP2: Use system font for menus - PSP2: Use system font for menus
- All: Faster memory read/write
0.4.1: (2016-07-11) 0.4.1: (2016-07-11)
Bugfixes: Bugfixes:

View File

@ -384,7 +384,7 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) {
if ((address & (SIZE_CART0 - 1)) < memory->romSize) { \ if ((address & (SIZE_CART0 - 1)) < memory->romSize) { \
LOAD_32(value, address & (SIZE_CART0 - 4), memory->rom); \ LOAD_32(value, address & (SIZE_CART0 - 4), memory->rom); \
} else if (memory->mirroring && (address & memory->romMask) < memory->romSize) { \ } else if (memory->mirroring && (address & memory->romMask) < memory->romSize) { \
LOAD_32(value, address & memory->romMask, memory->rom); \ LOAD_32(value, address & memory->romMask & -4, memory->rom); \
} else if (memory->vfame.cartType) { \ } else if (memory->vfame.cartType) { \
value = GBAVFameGetPatternValue(address, 32); \ value = GBAVFameGetPatternValue(address, 32); \
} else { \ } else { \

View File

@ -93,12 +93,12 @@ typedef intptr_t ssize_t;
#error Big endian build not supported on this platform. #error Big endian build not supported on this platform.
#endif #endif
#else #else
#define LOAD_64LE(DEST, ADDR, ARR) DEST = ((uint64_t*) ARR)[(ADDR) >> 3] #define LOAD_64LE(DEST, ADDR, ARR) DEST = *(uint64_t*) ((uintptr_t) (ARR) + (size_t) (ADDR))
#define LOAD_32LE(DEST, ADDR, ARR) DEST = ((uint32_t*) ARR)[(ADDR) >> 2] #define LOAD_32LE(DEST, ADDR, ARR) DEST = *(uint32_t*) ((uintptr_t) (ARR) + (size_t) (ADDR))
#define LOAD_16LE(DEST, ADDR, ARR) DEST = ((uint16_t*) ARR)[(ADDR) >> 1] #define LOAD_16LE(DEST, ADDR, ARR) DEST = *(uint16_t*) ((uintptr_t) (ARR) + (size_t) (ADDR))
#define STORE_64LE(SRC, ADDR, ARR) ((uint64_t*) ARR)[(ADDR) >> 3] = SRC #define STORE_64LE(SRC, ADDR, ARR) *(uint64_t*) ((uintptr_t) (ARR) + (size_t) (ADDR)) = SRC
#define STORE_32LE(SRC, ADDR, ARR) ((uint32_t*) ARR)[(ADDR) >> 2] = SRC #define STORE_32LE(SRC, ADDR, ARR) *(uint32_t*) ((uintptr_t) (ARR) + (size_t) (ADDR)) = SRC
#define STORE_16LE(SRC, ADDR, ARR) ((uint16_t*) ARR)[(ADDR) >> 1] = SRC #define STORE_16LE(SRC, ADDR, ARR) *(uint16_t*) ((uintptr_t) (ARR) + (size_t) (ADDR)) = SRC
#endif #endif
#define MAKE_MASK(START, END) (((1 << ((END) - (START))) - 1) << (START)) #define MAKE_MASK(START, END) (((1 << ((END) - (START))) - 1) << (START))