all repos — mgba @ 5b2d797e6d8ebce898e0aa25f66d64b18fff4dc4

mGBA Game Boy Advance Emulator

GBA Video: Fix some undefined behavior in shifts
Vicki Pfau vi@endrift.com
Tue, 28 Jul 2020 15:43:01 -0700
commit

5b2d797e6d8ebce898e0aa25f66d64b18fff4dc4

parent

b38cac3be37fa05982bd3204f0822b95260040d7

2 files changed, 4 insertions(+), 4 deletions(-)

jump to
M src/feature/video-logger.csrc/feature/video-logger.c

@@ -182,7 +182,7 @@ logger->writeData(logger, &dirty, sizeof(dirty));

} void mVideoLoggerRendererWriteVRAM(struct mVideoLogger* logger, uint32_t address) { - int bit = 1 << (address >> 12); + int bit = 1U << (address >> 12); if (logger->vramDirtyBitmap[address >> 17] & bit) { return; }
M src/gba/renderers/video-software.csrc/gba/renderers/video-software.c

@@ -13,8 +13,8 @@

#include <mgba-util/arm-algo.h> #include <mgba-util/memory.h> -#define DIRTY_SCANLINE(R, Y) R->scanlineDirty[Y >> 5] |= (1 << (Y & 0x1F)) -#define CLEAN_SCANLINE(R, Y) R->scanlineDirty[Y >> 5] &= ~(1 << (Y & 0x1F)) +#define DIRTY_SCANLINE(R, Y) R->scanlineDirty[Y >> 5] |= (1U << (Y & 0x1F)) +#define CLEAN_SCANLINE(R, Y) R->scanlineDirty[Y >> 5] &= ~(1U << (Y & 0x1F)) static void GBAVideoSoftwareRendererInit(struct GBAVideoRenderer* renderer); static void GBAVideoSoftwareRendererDeinit(struct GBAVideoRenderer* renderer);

@@ -519,7 +519,7 @@ } else {

softwareRenderer->nextY = y + 1; } - bool dirty = softwareRenderer->scanlineDirty[y >> 5] & (1 << (y & 0x1F)); + bool dirty = softwareRenderer->scanlineDirty[y >> 5] & (1U << (y & 0x1F)); if (memcmp(softwareRenderer->nextIo, softwareRenderer->cache[y].io, sizeof(softwareRenderer->nextIo))) { memcpy(softwareRenderer->cache[y].io, softwareRenderer->nextIo, sizeof(softwareRenderer->nextIo)); dirty = true;