Skip to content

Commit

Permalink
refactor: simplify AllocatedPointNonInfinity::to_allocated_point
Browse files Browse the repository at this point in the history
  • Loading branch information
huitseeker committed Feb 28, 2024
1 parent bec419d commit a06ba42
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/gadgets/ecc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ impl<G: Group> AllocatedPoint<G> {
// convert back to AllocatedPoint
let res = {
// we set acc.is_infinity = self.is_infinity
let acc = acc.to_allocated_point(&self.is_infinity)?;
let acc = acc.to_allocated_point(&self.is_infinity);

// we remove the initial slack if bits[0] is as not as assumed (i.e., it is not 1)
let acc_minus_initial = {
Expand Down Expand Up @@ -530,7 +530,7 @@ impl<G: Group> AllocatedPoint<G> {
y,
is_infinity: res.is_infinity,
};
let mut p_complete = p.to_allocated_point(&self.is_infinity)?;
let mut p_complete = p.to_allocated_point(&self.is_infinity);

for (i, bit) in complete_bits.iter().enumerate() {
let temp = acc.add(cs.namespace(|| format!("add_complete {i}")), &p_complete)?;
Expand Down Expand Up @@ -630,12 +630,12 @@ impl<G: Group> AllocatedPointNonInfinity<G> {
pub fn to_allocated_point(
&self,
is_infinity: &AllocatedNum<G::Base>,
) -> Result<AllocatedPoint<G>, SynthesisError> {
Ok(AllocatedPoint {
) -> AllocatedPoint<G> {
AllocatedPoint {
x: self.x.clone(),
y: self.y.clone(),
is_infinity: is_infinity.clone(),
})
}
}

/// Returns coordinates associated with the point.
Expand Down

0 comments on commit a06ba42

Please sign in to comment.