From 2439ef551545daee25be84c5119662a43501ac5a Mon Sep 17 00:00:00 2001 From: Ben Ruijl Date: Thu, 10 Oct 2024 19:04:55 +0200 Subject: [PATCH] Add quick return for addition with zero --- src/normalize.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/normalize.rs b/src/normalize.rs index 0be8b263..2d4b8133 100644 --- a/src/normalize.rs +++ b/src/normalize.rs @@ -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