improve parse_const check
This commit is contained in:
parent
0ae1bdb3e7
commit
2c2d2da645
|
@ -77,13 +77,11 @@ impl<R: BufRead> Deserializer<R> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_const(&mut self) -> Result<u64> {
|
fn parse_const(&mut self) -> Result<u64> {
|
||||||
let op = self.parse_op()?;
|
let bp::Op::Const(width, _float) = self.parse_op()? else {
|
||||||
|
return Err(Error::ExpectedConst);
|
||||||
|
};
|
||||||
|
|
||||||
if let bp::Op::Const(width, _float) = op {
|
Ok(self.read_uint((4 * (width + 1)) as usize)?)
|
||||||
Ok(self.read_uint((4 * (width + 1)) as usize)?)
|
|
||||||
} else {
|
|
||||||
Err(Error::ExpectedConst)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_data(&mut self) -> Result<u64> {
|
fn parse_data(&mut self) -> Result<u64> {
|
||||||
|
|
Loading…
Reference in New Issue