mirror of
https://github.com/saymrwulf/risc0-curve25519-dalek-source.git
synced 2026-09-04 20:03:40 +00:00
Implement {AddAssign, SubAssign} for ExtendedPoint.
This commit is contained in:
parent
961e71ee58
commit
ed315ffcae
1 changed files with 13 additions and 0 deletions
13
src/curve.rs
13
src/curve.rs
|
|
@ -83,6 +83,7 @@ use collections::Vec;
|
|||
use core::fmt::Debug;
|
||||
use core::iter::Iterator;
|
||||
use core::ops::{Add, Sub, Neg};
|
||||
use core::ops::{AddAssign, SubAssign};
|
||||
use core::ops::{Mul, MulAssign};
|
||||
use core::ops::Index;
|
||||
|
||||
|
|
@ -802,6 +803,12 @@ impl<'a,'b> Add<&'b ExtendedPoint> for &'a ExtendedPoint {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'b> AddAssign<&'b ExtendedPoint> for ExtendedPoint {
|
||||
fn add_assign(&mut self, _rhs: &'b ExtendedPoint) {
|
||||
*self = (self as &ExtendedPoint) + _rhs;
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a,'b> Sub<&'b ExtendedPoint> for &'a ExtendedPoint {
|
||||
type Output = ExtendedPoint;
|
||||
fn sub(self, other: &'b ExtendedPoint) -> ExtendedPoint {
|
||||
|
|
@ -809,6 +816,12 @@ impl<'a,'b> Sub<&'b ExtendedPoint> for &'a ExtendedPoint {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'b> SubAssign<&'b ExtendedPoint> for ExtendedPoint {
|
||||
fn sub_assign(&mut self, _rhs: &'b ExtendedPoint) {
|
||||
*self = (self as &ExtendedPoint) - _rhs;
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Neg for &'a ExtendedPoint {
|
||||
type Output = ExtendedPoint;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue