Add affine mixed addition operator overloading.
This commit is contained in:
parent
1d2a424c1e
commit
26de2362db
20
src/lib.rs
20
src/lib.rs
|
@ -704,6 +704,26 @@ impl<'a, 'b> Sub<&'b ExtendedPoint> for &'a ExtendedPoint {
|
||||||
|
|
||||||
impl_binops_additive!(ExtendedPoint, ExtendedPoint);
|
impl_binops_additive!(ExtendedPoint, ExtendedPoint);
|
||||||
|
|
||||||
|
impl<'a, 'b> Add<&'b AffinePoint> for &'a ExtendedPoint {
|
||||||
|
type Output = ExtendedPoint;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn add(self, other: &'b AffinePoint) -> ExtendedPoint {
|
||||||
|
self + other.to_niels()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a, 'b> Sub<&'b AffinePoint> for &'a ExtendedPoint {
|
||||||
|
type Output = ExtendedPoint;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn sub(self, other: &'b AffinePoint) -> ExtendedPoint {
|
||||||
|
self - other.to_niels()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl_binops_additive!(ExtendedPoint, AffinePoint);
|
||||||
|
|
||||||
/// This is a "completed" point produced during a point doubling or
|
/// This is a "completed" point produced during a point doubling or
|
||||||
/// addition routine. These points exist in the `(U:Z, V:T)` model
|
/// addition routine. These points exist in the `(U:Z, V:T)` model
|
||||||
/// of the curve. This is not exposed in the API because it is
|
/// of the curve. This is not exposed in the API because it is
|
||||||
|
|
Loading…
Reference in New Issue