Add affine mixed addition operator overloading.

This commit is contained in:
Sean Bowe 2019-03-26 20:59:28 -06:00
parent 1d2a424c1e
commit 26de2362db
No known key found for this signature in database
GPG Key ID: 95684257D8F8B031
1 changed files with 20 additions and 0 deletions

View File

@ -704,6 +704,26 @@ impl<'a, 'b> Sub<&'b ExtendedPoint> for &'a 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
/// 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