mirror of
https://github.com/arnaucube/ark-r1cs-std.git
synced 2026-01-09 23:41:33 +01:00
Use operator syntax
eliminate a few redundant references
This commit is contained in:
committed by
Pratyush Mishra
parent
b42d5f8d36
commit
f1d8b122fc
@@ -134,10 +134,10 @@ impl<G: Group, W: PedersenWindow> FixedLengthCRH for BoweHopwoodPedersenCRH<G, W
|
||||
.map(|(chunk_bits, generator)| {
|
||||
let mut encoded = generator.clone();
|
||||
if chunk_bits[0] {
|
||||
encoded = encoded + &generator;
|
||||
encoded = encoded + generator;
|
||||
}
|
||||
if chunk_bits[1] {
|
||||
encoded = encoded + &generator.double();
|
||||
encoded += &generator.double();
|
||||
}
|
||||
if chunk_bits[2] {
|
||||
encoded = encoded.neg();
|
||||
|
||||
@@ -106,7 +106,7 @@ impl<G: Group, W: PedersenWindow> FixedLengthCRH for PedersenCRH<G, W> {
|
||||
let mut encoded = G::zero();
|
||||
for (bit, base) in bits.iter().zip(generator_powers.iter()) {
|
||||
if *bit {
|
||||
encoded = encoded + base;
|
||||
encoded += base;
|
||||
}
|
||||
}
|
||||
encoded
|
||||
|
||||
@@ -205,7 +205,7 @@ impl UInt32 {
|
||||
all_constants = false;
|
||||
|
||||
// Add coeff * bit_gadget
|
||||
lc = lc + (coeff, bit.get_variable());
|
||||
lc += (coeff, bit.get_variable());
|
||||
},
|
||||
Boolean::Not(ref bit) => {
|
||||
all_constants = false;
|
||||
@@ -215,7 +215,7 @@ impl UInt32 {
|
||||
},
|
||||
Boolean::Constant(bit) => {
|
||||
if bit {
|
||||
lc = lc + (coeff, CS::one());
|
||||
lc += (coeff, CS::one());
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ impl<F: PrimeField> ToBitsGadget<F> for FpGadget<F> {
|
||||
let mut coeff = F::one();
|
||||
|
||||
for bit in bits.iter().rev() {
|
||||
lc = lc + (coeff, bit.get_variable());
|
||||
lc += (coeff, bit.get_variable());
|
||||
|
||||
coeff.double_in_place();
|
||||
}
|
||||
@@ -412,7 +412,7 @@ impl<F: PrimeField> ToBytesGadget<F> for FpGadget<F> {
|
||||
{
|
||||
match bit {
|
||||
Boolean::Is(bit) => {
|
||||
lc = lc + (coeff, bit.get_variable());
|
||||
lc += (coeff, bit.get_variable());
|
||||
coeff.double_in_place();
|
||||
},
|
||||
Boolean::Constant(_) | Boolean::Not(_) => unreachable!(),
|
||||
|
||||
@@ -994,7 +994,7 @@ mod projective_impl {
|
||||
let mut coords = vec![];
|
||||
for _ in 0..4 {
|
||||
coords.push(acc_power);
|
||||
acc_power = acc_power + base_power;
|
||||
acc_power += base_power;
|
||||
}
|
||||
|
||||
let bits = bits.borrow().to_bits(
|
||||
|
||||
Reference in New Issue
Block a user