mirror of
https://github.com/arnaucube/ark-r1cs-std.git
synced 2026-01-12 00:41:32 +01:00
Remove a few unnecessary clones
This commit is contained in:
committed by
Pratyush Mishra
parent
d71bc5a675
commit
c42c7dd98a
@@ -39,7 +39,7 @@ impl<P: Bls12Parameters> PairingGadget<P> {
|
||||
TwistType::M => {
|
||||
let c0 = coeffs.0.clone();
|
||||
let mut c1 = coeffs.1.clone();
|
||||
let c2 = Fp2G::<P>::new(p.y.clone(), zero.clone());
|
||||
let c2 = Fp2G::<P>::new(p.y.clone(), zero);
|
||||
|
||||
c1.c0 = c1.c0.mul(cs.ns(|| "mul c1.c0"), &p.x)?;
|
||||
c1.c1 = c1.c1.mul(cs.ns(|| "mul c1.c1"), &p.x)?;
|
||||
@@ -47,7 +47,7 @@ impl<P: Bls12Parameters> PairingGadget<P> {
|
||||
Ok(())
|
||||
},
|
||||
TwistType::D => {
|
||||
let c0 = Fp2G::<P>::new(p.y.clone(), zero.clone());
|
||||
let c0 = Fp2G::<P>::new(p.y.clone(), zero);
|
||||
let mut c1 = coeffs.0.clone();
|
||||
let c2 = coeffs.1.clone();
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ mod test {
|
||||
let (ans1_g, ans1_n) = {
|
||||
let ans_g = PairingGadget::pairing(
|
||||
cs.ns(|| "pair(sa, b)"),
|
||||
sa_prep_g.clone(),
|
||||
sa_prep_g,
|
||||
b_prep_g.clone(),
|
||||
)
|
||||
.unwrap();
|
||||
@@ -120,7 +120,7 @@ mod test {
|
||||
let ans_g = PairingGadget::pairing(
|
||||
cs.ns(|| "pair(a, sb)"),
|
||||
a_prep_g.clone(),
|
||||
sb_prep_g.clone(),
|
||||
sb_prep_g,
|
||||
)
|
||||
.unwrap();
|
||||
let ans_n = Bls12_377::pairing(a, sb);
|
||||
@@ -129,11 +129,11 @@ mod test {
|
||||
|
||||
let (ans3_g, ans3_n) = {
|
||||
let s_iter = BitIterator::new(s.into_repr())
|
||||
.map(|bit| Boolean::constant(bit))
|
||||
.map(Boolean::constant)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let mut ans_g =
|
||||
PairingGadget::pairing(cs.ns(|| "pair(a, b)"), a_prep_g.clone(), b_prep_g.clone())
|
||||
PairingGadget::pairing(cs.ns(|| "pair(a, b)"), a_prep_g, b_prep_g)
|
||||
.unwrap();
|
||||
let mut ans_n = Bls12_377::pairing(a, b);
|
||||
ans_n = ans_n.pow(s.into_repr());
|
||||
|
||||
Reference in New Issue
Block a user