Fix some warnings and TODO's.

This commit is contained in:
Sean Bowe 2017-11-12 13:45:13 -07:00
parent d616362884
commit b15f5f6f43
2 changed files with 19 additions and 20 deletions

View File

@ -57,7 +57,7 @@ impl<E: Engine> LinearCombination<E> {
}
pub fn eval(
self,
&self,
mut input_density: Option<&mut DensityTracker>,
mut aux_density: Option<&mut DensityTracker>,
input_assignment: &[E::Fr],
@ -66,7 +66,7 @@ impl<E: Engine> LinearCombination<E> {
{
let mut acc = E::Fr::zero();
for (index, coeff) in self.0.into_iter() {
for &(index, coeff) in self.0.iter() {
let mut tmp;
match index {
@ -262,11 +262,9 @@ impl<E: Engine> TestConstraintSystem<E> {
pub fn is_satisfied(&self) -> bool
{
for &(ref a, ref b, ref c) in &self.constraints {
// TODO: make eval not take self by value
let mut a = a.clone().eval(None, None, &self.inputs, &self.aux);
let b = b.clone().eval(None, None, &self.inputs, &self.aux);
let c = c.clone().eval(None, None, &self.inputs, &self.aux);
let mut a = a.eval(None, None, &self.inputs, &self.aux);
let b = b.eval(None, None, &self.inputs, &self.aux);
let c = c.eval(None, None, &self.inputs, &self.aux);
a.mul_assign(&b);

View File

@ -3,7 +3,7 @@ use std::sync::Arc;
use std::io;
use bit_vec::{self, BitVec};
use std::iter;
use futures::{BoxFuture, Future};
use futures::{Future};
use futures_cpupool::CpuPool;
use super::Error;
@ -138,7 +138,7 @@ fn multiexp_inner<Q, D, G, S>(
mut skip: u32,
c: u32,
handle_trivial: bool
) -> BoxFuture<<G as CurveAffine>::Projective, Error>
) -> Box<Future<Item=<G as CurveAffine>::Projective, Error=Error>>
where for<'a> &'a Q: QueryDensity,
D: Send + Sync + 'static + Clone + AsRef<Q>,
G: CurveAffine,
@ -206,21 +206,22 @@ fn multiexp_inner<Q, D, G, S>(
if skip >= <G::Engine as Engine>::Fr::NUM_BITS {
// There isn't another region.
this.boxed()
Box::new(this)
} else {
// There's another region more significant. Calculate and join it with
// this region recursively.
this.join(multiexp_inner(pool, bases, density_map, exponents, skip, c, false))
.map(move |(this, mut higher)| {
for _ in 0..c {
higher.double();
}
Box::new(
this.join(multiexp_inner(pool, bases, density_map, exponents, skip, c, false))
.map(move |(this, mut higher)| {
for _ in 0..c {
higher.double();
}
higher.add_assign(&this);
higher.add_assign(&this);
higher
})
.boxed()
higher
})
)
}
}
@ -233,7 +234,7 @@ pub fn multiexp<Q, D, G, S>(
exponents: Arc<Vec<<<G::Engine as Engine>::Fr as PrimeField>::Repr>>,
// TODO
// c: u32
) -> BoxFuture<<G as CurveAffine>::Projective, Error>
) -> Box<Future<Item=<G as CurveAffine>::Projective, Error=Error>>
where for<'a> &'a Q: QueryDensity,
D: Send + Sync + 'static + Clone + AsRef<Q>,
G: CurveAffine,