Skip to content

Commit

Permalink
Add quick return for addition with zero
Browse files Browse the repository at this point in the history
  • Loading branch information
benruijl committed Oct 10, 2024
1 parent 280c2a6 commit 2439ef5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/normalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,11 @@ impl<'a> AtomView<'a> {
}

if let AtomView::Add(a1) = self {
if rhs.is_zero() {
self.clone_into(out);
return;
}

let mut found = false;
for x in a1.iter() {
// TODO: find the position of rhs in self with a binary search
Expand Down

0 comments on commit 2439ef5

Please sign in to comment.