From 66a56544359b069bf0a7cdfa9106ef1cfe621423 Mon Sep 17 00:00:00 2001 From: Alessandro Coglio Date: Tue, 26 Dec 2023 22:28:53 -0800 Subject: [PATCH] Use is_zero(). --- circuit/types/field/src/square_root.rs | 2 +- circuit/types/group/src/helpers/from_x_coordinate.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/circuit/types/field/src/square_root.rs b/circuit/types/field/src/square_root.rs index ed7364a6df..d6abc7b09e 100644 --- a/circuit/types/field/src/square_root.rs +++ b/circuit/types/field/src/square_root.rs @@ -119,7 +119,7 @@ impl Field { let second_root = first_root.clone().neg(); // The error flag is set iff self is a non-square, i.e. it is neither zero nor a non-zero square. - let is_nonzero = self.is_not_equal(&Field::zero()); + let is_nonzero = !self.is_zero(); let error_flag = is_nonzero.bitand(is_nonzero_square.not()); (error_flag, first_root, second_root) diff --git a/circuit/types/group/src/helpers/from_x_coordinate.rs b/circuit/types/group/src/helpers/from_x_coordinate.rs index 1a6c4a0f6c..42bb31352f 100644 --- a/circuit/types/group/src/helpers/from_x_coordinate.rs +++ b/circuit/types/group/src/helpers/from_x_coordinate.rs @@ -78,8 +78,8 @@ impl Group { } let point1_times_order = order_bits_be_constants.mul(point1); let point2_times_order = order_bits_be_constants.mul(point2); - let point1_is_in_subgroup = point1_times_order.is_equal(&Self::zero()); - let point2_is_in_subgroup = point2_times_order.is_equal(&Self::zero()); + let point1_is_in_subgroup = point1_times_order.is_zero(); + let point2_is_in_subgroup = point2_times_order.is_zero(); // We select y1 if (x, y1) is in the subgroup (which implies that (x, y2) is not in the subgroup), // or y2 if (x, y2) is in the subgroup (which implies that (x, y1) is not in the subgroup),