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)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
#[repr(C)]
|
|
||||||
pub enum TileFormat {
|
pub enum TileFormat {
|
||||||
FourBpp = 0,
|
FourBpp = 5,
|
||||||
EightBpp = 1,
|
EightBpp = 6,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TileFormat {
|
impl TileFormat {
|
||||||
/// Returns the size of the tile in bytes
|
/// Returns the size of the tile in bytes
|
||||||
pub(crate) const fn tile_size(self) -> usize {
|
pub(crate) const fn tile_size(self) -> usize {
|
||||||
match self {
|
1 << self as usize
|
||||||
TileFormat::FourBpp => 8 * 8 / 2,
|
|
||||||
TileFormat::EightBpp => 8 * 8,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue