From aa0e3399f6cb3930c4938edbfcd5fe01346ffd8d Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Thu, 17 Jun 2021 17:43:04 -0500 Subject: [PATCH] chore(ppu): fix integer overflow --- src/ppu.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ppu.rs b/src/ppu.rs index 0705daa..0332bd5 100644 --- a/src/ppu.rs +++ b/src/ppu.rs @@ -713,12 +713,12 @@ impl PixelFetcher { }; let offset = if is_window { - self.back.window_line.count() % 8 + self.back.window_line.count() as u16 % 8 } else { - (line_y + scroll_y) % 8 + (line_y as u16 + scroll_y as u16) % 8 }; - tile_data_addr + (2 * offset as u16) + tile_data_addr + (offset * 2) } fn send_to_fifo(&self, fifo: &mut FifoRenderer, palette: &BackgroundPalette) {