From 5b3248ec5a985a753b88b59d3c63b9dff4971d21 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 6 Sep 2023 08:51:47 +0100 Subject: [PATCH] Massively improve the code generation around tile sizes --- agb/src/display/tiled/vram_manager.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/agb/src/display/tiled/vram_manager.rs b/agb/src/display/tiled/vram_manager.rs index d5526d35..059e8a8e 100644 --- a/agb/src/display/tiled/vram_manager.rs +++ b/agb/src/display/tiled/vram_manager.rs @@ -29,19 +29,15 @@ const fn layout_of(format: TileFormat) -> Layout { } #[derive(Clone, Copy, Debug, PartialEq, Eq)] -#[repr(C)] pub enum TileFormat { - FourBpp = 0, - EightBpp = 1, + FourBpp = 5, + EightBpp = 6, } impl TileFormat { /// Returns the size of the tile in bytes pub(crate) const fn tile_size(self) -> usize { - match self { - TileFormat::FourBpp => 8 * 8 / 2, - TileFormat::EightBpp => 8 * 8, - } + 1 << self as usize } }