chore: cargo fmt
This commit is contained in:
parent
ff2d189344
commit
b889f626ab
|
@ -8,11 +8,10 @@ use core::fmt;
|
|||
use fogtix_bytecode::{consts, Instr, Parse};
|
||||
|
||||
fn next_instr(m: &[u8], pos: usize) -> Option<Result<(usize, Instr), &[u8]>> {
|
||||
m.get(pos..)
|
||||
.map(|nxti_arr| match Instr::parse(nxti_arr) {
|
||||
Err(_) => Err(&nxti_arr[..core::cmp::min(nxti_arr.len(), 20)]),
|
||||
Ok((ptr, i)) => Ok((nxti_arr.len() - ptr.len(), i)),
|
||||
})
|
||||
m.get(pos..).map(|nxti_arr| match Instr::parse(nxti_arr) {
|
||||
Err(_) => Err(&nxti_arr[..core::cmp::min(nxti_arr.len(), 20)]),
|
||||
Ok((ptr, i)) => Ok((nxti_arr.len() - ptr.len(), i)),
|
||||
})
|
||||
}
|
||||
|
||||
fn is_call2jump(m: &[u8], pos: usize) -> bool {
|
||||
|
@ -128,20 +127,12 @@ impl Process<'_> {
|
|||
Ok(y) => y,
|
||||
Err(_) => return Err(Error::InstrpOutOfBounds),
|
||||
};
|
||||
self.verify_jumptarget(
|
||||
"call-l",
|
||||
previptr,
|
||||
)?;
|
||||
self.verify_jumptarget("call-l", previptr)?;
|
||||
}
|
||||
Instr::CallLDefer(x) => match x.try_into() {
|
||||
Ok(pos) => {
|
||||
let jtip = pos;
|
||||
verify_jumptarget_explicit(
|
||||
"call-l-defer",
|
||||
self.m,
|
||||
previptr,
|
||||
jtip,
|
||||
)?;
|
||||
verify_jumptarget_explicit("call-l-defer", self.m, previptr, jtip)?;
|
||||
if is_call2jump(self.m, self.instrp) {
|
||||
self.instrp = jtip;
|
||||
} else {
|
||||
|
@ -157,10 +148,7 @@ impl Process<'_> {
|
|||
};
|
||||
if self.stpop()? != 0 {
|
||||
self.instrp = x;
|
||||
self.verify_jumptarget(
|
||||
"jump-cond",
|
||||
previptr,
|
||||
)?;
|
||||
self.verify_jumptarget("jump-cond", previptr)?;
|
||||
}
|
||||
}
|
||||
Instr::Return => match self.callstack.pop() {
|
||||
|
|
Loading…
Reference in a new issue