all repos — mgba @ 42f5934b25d5352c8dc185e8d1f133a9ade5ba7a

mGBA Game Boy Advance Emulator

All: Faster memory read/write
Jeffrey Pfau jeffrey@endrift.com
Sat, 30 Jul 2016 00:51:45 -0700
commit

42f5934b25d5352c8dc185e8d1f133a9ade5ba7a

parent

012c70a0cea381aefbaef9d4cff18bdd4af1e43c

3 files changed, 8 insertions(+), 7 deletions(-)

jump to
M CHANGESCHANGES

@@ -27,6 +27,7 @@ - 3DS: Allow UTF-16 filenames

- 3DS: Port to using citro3D - 3DS: Use system font for menus - PSP2: Use system font for menus + - All: Faster memory read/write 0.4.1: (2016-07-11) Bugfixes:
M src/gba/memory.csrc/gba/memory.c

@@ -384,7 +384,7 @@ wait += waitstatesRegion[address >> BASE_OFFSET]; \

if ((address & (SIZE_CART0 - 1)) < memory->romSize) { \ LOAD_32(value, address & (SIZE_CART0 - 4), memory->rom); \ } 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) { \ value = GBAVFameGetPatternValue(address, 32); \ } else { \
M src/util/common.hsrc/util/common.h

@@ -93,12 +93,12 @@ #else

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