Skip to content

Commit c89613a

Browse files
committed
Make ProjectiveMontgomeryXpoint::identity() an associated const
1 parent d4e7a21 commit c89613a

File tree

1 file changed

+5
-7
lines changed
  • ed448-goldilocks/src/montgomery

1 file changed

+5
-7
lines changed

ed448-goldilocks/src/montgomery/x.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl Mul<&EdwardsScalar> for &MontgomeryXpoint {
7575
fn mul(self, scalar: &EdwardsScalar) -> ProjectiveMontgomeryXpoint {
7676
// Algorithm 8 of Costello-Smith 2017
7777
let affine_u = FieldElement::from_bytes(&self.0);
78-
let mut x0 = ProjectiveMontgomeryXpoint::identity();
78+
let mut x0 = ProjectiveMontgomeryXpoint::IDENTITY;
7979
let mut x1 = ProjectiveMontgomeryXpoint {
8080
U: affine_u,
8181
W: FieldElement::ONE,
@@ -238,12 +238,10 @@ fn differential_add_and_double(
238238

239239
impl ProjectiveMontgomeryXpoint {
240240
/// The identity element of the group: the point at infinity.
241-
pub fn identity() -> ProjectiveMontgomeryXpoint {
242-
ProjectiveMontgomeryXpoint {
243-
U: FieldElement::ONE,
244-
W: FieldElement::ZERO,
245-
}
246-
}
241+
pub const IDENTITY: Self = Self {
242+
U: FieldElement::ONE,
243+
W: FieldElement::ZERO,
244+
};
247245

248246
/// Convert the point to affine form
249247
pub fn to_affine(&self) -> MontgomeryXpoint {

0 commit comments

Comments
 (0)