fix: improve types of heap allocated arrays

This commit is contained in:
2021-03-16 22:51:41 -05:00
parent 528b88eeb7
commit 06821bf880
4 changed files with 12 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
#[derive(Debug, Clone)]
pub struct WorkRam {
bank: Box<[u8]>,
bank: Box<[u8; 4096]>,
}
impl WorkRam {
@@ -16,7 +16,7 @@ impl WorkRam {
impl Default for WorkRam {
fn default() -> Self {
Self {
bank: vec![0u8; 4096].into_boxed_slice(),
bank: Box::new([0u8; 4096]),
}
}
}
@@ -35,14 +35,14 @@ pub enum BankNumber {
#[derive(Debug, Clone)]
pub struct VariableWorkRam {
current: BankNumber,
bank_n: Box<[[u8; 4096]]>, // 4K for Variable amount of Banks (Banks 1 -> 7) in Game Boy Colour
bank_n: Box<[[u8; 4096]; 7]>, // 4K for Variable amount of Banks (Banks 1 -> 7) in Game Boy Colour
}
impl Default for VariableWorkRam {
fn default() -> Self {
Self {
current: BankNumber::One,
bank_n: vec![[0u8; 4096]; 7].into_boxed_slice(),
bank_n: Box::new([[0u8; 4096]; 7]),
}
}
}