mirror of
https://github.com/arnaucube/ark-r1cs-std.git
synced 2026-01-10 16:01:28 +01:00
Use built-in iteration functions more
This commit is contained in:
committed by
Pratyush Mishra
parent
c42c7dd98a
commit
53a51eb4dc
@@ -144,9 +144,9 @@ impl<G: Group, W: PedersenWindow> FixedLengthCRH for BoweHopwoodPedersenCRH<G, W
|
|||||||
}
|
}
|
||||||
encoded
|
encoded
|
||||||
})
|
})
|
||||||
.reduce(|| G::zero(), |a, b| a + &b)
|
.reduce(G::zero, |a, b| a + &b)
|
||||||
})
|
})
|
||||||
.reduce(|| G::zero(), |a, b| a + &b);
|
.reduce(G::zero, |a, b| a + &b);
|
||||||
end_timer!(eval_time);
|
end_timer!(eval_time);
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ impl<G: Group, W: PedersenWindow> FixedLengthCRH for PedersenCRH<G, W> {
|
|||||||
}
|
}
|
||||||
encoded
|
encoded
|
||||||
})
|
})
|
||||||
.reduce(|| G::zero(), |a, b| a + &b);
|
.reduce(G::zero, |a, b| a + &b);
|
||||||
end_timer!(eval_time);
|
end_timer!(eval_time);
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
|
|||||||
@@ -586,7 +586,7 @@ impl Boolean {
|
|||||||
// This is part of a run of ones.
|
// This is part of a run of ones.
|
||||||
current_run.push(a.clone());
|
current_run.push(a.clone());
|
||||||
} else {
|
} else {
|
||||||
if current_run.len() > 0 {
|
if !current_run.is_empty() {
|
||||||
// This is the start of a run of zeros, but we need
|
// This is the start of a run of zeros, but we need
|
||||||
// to k-ary AND against `last_run` first.
|
// to k-ary AND against `last_run` first.
|
||||||
|
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ mod test {
|
|||||||
assert_eq!(a_inv.get_value().unwrap(), a_native.inverse().unwrap());
|
assert_eq!(a_inv.get_value().unwrap(), a_native.inverse().unwrap());
|
||||||
// a * a * a = a^3
|
// a * a * a = a^3
|
||||||
let bits = BitIterator::new([0x3])
|
let bits = BitIterator::new([0x3])
|
||||||
.map(|bit| Boolean::constant(bit))
|
.map(Boolean::constant)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
a_native * &(a_native * &a_native),
|
a_native * &(a_native * &a_native),
|
||||||
|
|||||||
@@ -71,9 +71,6 @@ pub trait Assignment<T> {
|
|||||||
|
|
||||||
impl<T> Assignment<T> for Option<T> {
|
impl<T> Assignment<T> for Option<T> {
|
||||||
fn get(self) -> Result<T, r1cs_core::SynthesisError> {
|
fn get(self) -> Result<T, r1cs_core::SynthesisError> {
|
||||||
match self {
|
self.ok_or_else(|| { r1cs_core::SynthesisError::AssignmentMissing })
|
||||||
Some(v) => Ok(v),
|
|
||||||
None => Err(r1cs_core::SynthesisError::AssignmentMissing),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user