Make Field::double take &self and return Self

This commit is contained in:
Jack Grigg
2019-12-12 22:59:18 +00:00
parent 91c32f1c7c
commit 9dac748224
23 changed files with 87 additions and 111 deletions

View File

@@ -340,7 +340,7 @@ impl<E: JubjubEngine> EdwardsPoint<E> {
// Compute x3 = (2.A) / (1 + C)
let x3 = AllocatedNum::alloc(cs.namespace(|| "x3"), || {
let mut t0 = *a.get_value().get()?;
t0.double();
t0 = t0.double();
let mut t1 = E::Fr::one();
t1.add_assign(c.get_value().get()?);
@@ -366,8 +366,7 @@ impl<E: JubjubEngine> EdwardsPoint<E> {
// Compute y3 = (U - 2.A) / (1 - C)
let y3 = AllocatedNum::alloc(cs.namespace(|| "y3"), || {
let mut t0 = *a.get_value().get()?;
t0.double();
t0 = t0.neg();
t0 = t0.double().neg();
t0.add_assign(t.get_value().get()?);
let mut t1 = E::Fr::one();

View File

@@ -245,7 +245,7 @@ impl<'a, E: JubjubEngine> Circuit<E> for Spend<'a, E> {
let mut coeff = E::Fr::one();
for bit in &value_bits {
value_num = value_num.add_bool_with_coeff(CS::one(), bit, coeff);
coeff.double();
coeff = coeff.double();
}
// Place the value in the note

View File

@@ -268,7 +268,7 @@ impl NoteValue {
let mut coeff = E::Fr::one();
for b in &self.bits {
tmp = tmp + (coeff, b.get_variable());
coeff.double();
coeff = coeff.double();
}
tmp