From 6ca5e29f7272be7dfd245416b7f55c0457209210 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Mon, 19 Aug 2019 19:06:22 -0700 Subject: Small optimization to render_map in VDP code --- vdp.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'vdp.c') diff --git a/vdp.c b/vdp.c index 3b6375b..65f2066 100644 --- a/vdp.c +++ b/vdp.c @@ -1197,28 +1197,25 @@ static void render_map(uint16_t col, uint8_t * tmp_buf, uint8_t offset, vdp_cont } uint8_t pal_priority = (col >> 9) & 0x70; uint32_t bits = *((uint32_t *)(&context->vdpmem[address])); + tmp_buf += offset; if (col & MAP_BIT_H_FLIP) { uint32_t shift = 28; for (int i = 0; i < 4; i++) { uint8_t right = pal_priority | ((bits >> shift) & 0xF); shift -= 4; - tmp_buf[offset++] = pal_priority | ((bits >> shift) & 0xF); + *(tmp_buf++) = pal_priority | ((bits >> shift) & 0xF); shift -= 4; - offset &= SCROLL_BUFFER_MASK; - tmp_buf[offset++] = right; - offset &= SCROLL_BUFFER_MASK; + *(tmp_buf++) = right; } } else { for (int i = 0; i < 4; i++) { uint8_t right = pal_priority | (bits & 0xF); bits >>= 4; - tmp_buf[offset++] = pal_priority | (bits & 0xF); - offset &= SCROLL_BUFFER_MASK; + *(tmp_buf++) = pal_priority | (bits & 0xF); bits >>= 4; - tmp_buf[offset++] = right; - offset &= SCROLL_BUFFER_MASK; + *(tmp_buf++) = right; } } } -- cgit v1.2.3