Smol fix
This commit is contained in:
parent
bc6e483bcf
commit
5756a60eed
|
@ -30,10 +30,14 @@ impl LBAEntry {
|
|||
pub fn write_entry(&mut self, lba: u16, mut size_bytes: usize) -> Result<(), Error> {
|
||||
const WORD_SIZE:usize = std::mem::size_of::<u32>();
|
||||
|
||||
if self.lba != 0 || self.size_words != 0 {
|
||||
return Err(Error::from_str("LBA Entry will overwrite non-zero value!\nIs no space allocated for the LBA Entries?"));
|
||||
}
|
||||
|
||||
size_bytes = (size_bytes + (WORD_SIZE - 1))/WORD_SIZE;
|
||||
|
||||
if (size_bytes as u16) as usize != size_bytes {
|
||||
return Err(Error::from_text(format!("{} words can not be incoded into 16bit", size_bytes)));
|
||||
return Err(Error::from_text(format!("{} words can not be encoded into 16bit", size_bytes)));
|
||||
}
|
||||
|
||||
let lba = lba.to_le_bytes();
|
||||
|
|
Loading…
Reference in New Issue