Update code comments in examples

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
str4d 2021-11-30 22:33:23 +00:00 committed by Jack Grigg
parent 839f9ecd66
commit 4b8f0f0c6b
2 changed files with 12 additions and 9 deletions

View File

@ -216,11 +216,12 @@ impl<F: FieldExt> NumericInstructions<F> for FieldChip<F> {
a.0.copy_advice(|| "lhs", &mut region, config.advice[0], 0)?;
b.0.copy_advice(|| "rhs", &mut region, config.advice[1], 0)?;
// Now we can assign the multiplication result into the output position.
// Now we can assign the multiplication result, which is to be assigned
// into the output position.
let value = a.0.value().and_then(|a| b.0.value().map(|b| *a * *b));
// Finally, we return a variable representing the output,
// to be used in another part of the circuit.
// Finally, we do the assignment to the output, returning a
// variable to be used in another part of the circuit.
region
.assign_advice(
|| "lhs * rhs",

View File

@ -217,11 +217,12 @@ impl<F: FieldExt> AddInstructions<F> for AddChip<F> {
a.0.copy_advice(|| "lhs", &mut region, config.advice[0], 0)?;
b.0.copy_advice(|| "rhs", &mut region, config.advice[1], 0)?;
// Now we can assign the addition result into the output position.
// Now we can compute the addition result, which is to be assigned
// into the output position.
let value = a.0.value().and_then(|a| b.0.value().map(|b| *a + *b));
// Finally, we return a variable representing the output,
// to be used in another part of the circuit.
// Finally, we do the assignment to the output, returning a
// variable to be used in another part of the circuit.
region
.assign_advice(
|| "lhs + rhs",
@ -342,11 +343,12 @@ impl<F: FieldExt> MulInstructions<F> for MulChip<F> {
a.0.copy_advice(|| "lhs", &mut region, config.advice[0], 0)?;
b.0.copy_advice(|| "rhs", &mut region, config.advice[1], 0)?;
// Now we can assign the multiplication result into the output position.
// Now we can compute the multiplication result, which is to be assigned
// into the output position.
let value = a.0.value().and_then(|a| b.0.value().map(|b| *a * *b));
// Finally, we return a variable representing the output,
// to be used in another part of the circuit.
// Finally, we do the assignment to the output, returning a
// variable to be used in another part of the circuit.
region
.assign_advice(
|| "lhs * rhs",