Move from Curve*::negate to Neg operator

This commit is contained in:
Jack Grigg 2019-05-27 17:36:22 +01:00
parent 2013561f4c
commit 23443c7e8d
2 changed files with 3 additions and 13 deletions

View File

@ -417,10 +417,6 @@ impl CurveProjective for Fr {
AddAssign::add_assign(self, other);
}
fn negate(&mut self) {
self.0 = self.neg().0;
}
fn mul_assign<S: Into<<Self::Scalar as PrimeField>::Repr>>(&mut self, other: S) {
let tmp = Fr::from_repr(other.into()).unwrap();
@ -499,10 +495,6 @@ impl CurveAffine for Fr {
<Fr as Field>::is_zero(self)
}
fn negate(&mut self) {
self.0 = self.neg().0;
}
fn mul<S: Into<<Self::Scalar as PrimeField>::Repr>>(&self, other: S) -> Self::Projective {
let mut res = *self;
let tmp = Fr::from_repr(other.into()).unwrap();

View File

@ -1,17 +1,15 @@
use ff::PrimeField;
use group::{CurveAffine, CurveProjective};
use pairing::{Engine, PairingCurveAffine};
use std::ops::AddAssign;
use std::ops::{AddAssign, Neg};
use super::{PreparedVerifyingKey, Proof, VerifyingKey};
use crate::SynthesisError;
pub fn prepare_verifying_key<E: Engine>(vk: &VerifyingKey<E>) -> PreparedVerifyingKey<E> {
let mut gamma = vk.gamma_g2;
gamma.negate();
let mut delta = vk.delta_g2;
delta.negate();
let gamma = vk.gamma_g2.neg();
let delta = vk.delta_g2.neg();
PreparedVerifyingKey {
alpha_g1_beta_g2: E::pairing(vk.alpha_g1, vk.beta_g2),