Smol fix
This commit is contained in:
parent
9d1b35bf8c
commit
4d12536d69
|
@ -30,10 +30,14 @@ impl LBAEntry {
|
||||||
pub fn write_entry(&mut self, lba: u16, mut size_bytes: usize) -> Result<(), Error> {
|
pub fn write_entry(&mut self, lba: u16, mut size_bytes: usize) -> Result<(), Error> {
|
||||||
const WORD_SIZE:usize = std::mem::size_of::<u32>();
|
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;
|
size_bytes = (size_bytes + (WORD_SIZE - 1))/WORD_SIZE;
|
||||||
|
|
||||||
if (size_bytes as u16) as usize != size_bytes {
|
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();
|
let lba = lba.to_le_bytes();
|
||||||
|
|
Loading…
Reference in New Issue