Skip to content

Commit

Permalink
re-use Encoder::op_num (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
enricozb authored Apr 6, 2024
1 parent 87040fe commit f13f24c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/host/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,14 @@ impl<'a, E: Encoder> State<'a, E> {
self.encoder.link(l, r);
}
Tree::Op { op, rhs: lft, out: rgt } => {
let (l, r) = self.encoder.op(*op, trg);
self.visit_tree(lft, l);
self.visit_tree(rgt, r);
if let Tree::Num { val } = &**lft {
let o = self.encoder.op_num(*op, trg, *val);
self.visit_tree(rgt, o);
} else {
let (l, r) = self.encoder.op(*op, trg);
self.visit_tree(lft, l);
self.visit_tree(rgt, r);
}
}
Tree::Mat { zero, succ, out } => {
let (a, o) = self.encoder.mat(trg);
Expand Down

0 comments on commit f13f24c

Please sign in to comment.