From f9e6b3caa860e0d4c79eff8f6db609ccaf5423c0 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Thu, 22 Oct 2020 14:56:58 +0200 Subject: [PATCH] perf: a small optimization to signed_integer equality checks Signed-off-by: ljedrz --- gadgets/src/signed_integer/relational/eq.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gadgets/src/signed_integer/relational/eq.rs b/gadgets/src/signed_integer/relational/eq.rs index 0deb39d145..d783deb340 100644 --- a/gadgets/src/signed_integer/relational/eq.rs +++ b/gadgets/src/signed_integer/relational/eq.rs @@ -53,7 +53,8 @@ macro_rules! eq_gadget_impl { impl PartialEq for $gadget { fn eq(&self, other: &Self) -> bool { - !self.value.is_none() && !other.value.is_none() && self.value == other.value + // self.value == other.value means that other.value.is_some() too + self.value.is_some() && self.value == other.value } }