mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Massively improve the code generation around tile sizes
This commit is contained in:
parent
ed2e7dec5c
commit
5b3248ec5a
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue