Skip to content

Commit

Permalink
fix selectors_with_pc
Browse files Browse the repository at this point in the history
  • Loading branch information
cdump committed Nov 13, 2024
1 parent 992c304 commit b4d8b84
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/selectors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ fn analyze(
let selector: Selector = s1.data[28..32].try_into().expect("4 bytes slice is always convertable to Selector");
*vm.stack.peek_mut()? = Element{
data : if ret.op == op::EQ { VAL_0_B } else { VAL_1_B },
label : Some(Label::SelCmp(selector, ret.op == op::EQ)),
label : Some(Label::SelCmp(selector, false)),
}
}

StepResult{op: op::JUMPI, fa: Some(fa), sa: Some(Element{label: Some(Label::SelCmp(selector, is_eq)), ..}), ..} =>
StepResult{op: op::JUMPI, fa: Some(fa), sa: Some(Element{label: Some(Label::SelCmp(selector, reversed)), ..}), ..} =>
{
let pc = if is_eq {
usize::try_from(fa).expect("set to usize in vm.rs")
} else {
let pc = if reversed {
vm.pc + 1
} else {
usize::try_from(fa).expect("set to usize in vm.rs")
};
selectors.insert(selector, pc);
}
Expand Down Expand Up @@ -103,10 +103,10 @@ fn analyze(
v.label = Some(Label::CallData);
}

StepResult{op: op::ISZERO, fa: Some(Element{label: Some(Label::SelCmp(sel, is_eq)), ..}), ..} =>
StepResult{op: op::ISZERO, fa: Some(Element{label: Some(Label::SelCmp(sel, reversed)), ..}), ..} =>
{
let v = vm.stack.peek_mut()?;
v.label = Some(Label::SelCmp(sel, !is_eq));
v.label = Some(Label::SelCmp(sel, !reversed));
}

StepResult{op: op::ISZERO, fa: Some(Element{label: Some(Label::Signature), ..}), ..} =>
Expand Down

0 comments on commit b4d8b84

Please sign in to comment.