Skip to content

Commit

Permalink
add ref from
Browse files Browse the repository at this point in the history
  • Loading branch information
rnburn committed May 23, 2024
1 parent 710ee0a commit 8680864
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/compute/element_p2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ impl<P: SWCurveConfig> From<Affine<P>> for ElementP2<P> {
}
}

impl<P: SWCurveConfig> From<&Affine<P>> for ElementP2<P> {
fn from(pt: &Affine<P>) -> Self {
Self {
x: pt.x,
y: pt.y,
z: if pt.infinity {
P::BaseField::zero()
} else {
P::BaseField::one()
},
}
}
}

impl<P: SWCurveConfig> Into<Affine<P>> for ElementP2<P> {
fn into(self) -> Affine<P> {
if self.z.is_zero() {
Expand Down

0 comments on commit 8680864

Please sign in to comment.