Skip to content

Commit

Permalink
Another small change requested
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminsavage committed Sep 25, 2023
1 parent 636e193 commit 33aaec4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/protocol/boolean/saturating_sum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ impl<S: LinearSecretSharing<Gf2>> SaturatingSum<S> {

let mut output_sum = Vec::with_capacity(self.sum.len());
let mut carry_in = S::ZERO;
let zero = S::ZERO;
for i in 0..self.sum.len() {
let c = ctx.narrow(&BitOpStep::from(i));
let (sum_bit, carry_out) = if i < value.len() {
one_bit_adder(c, record_id, &value[i], &self.sum[i], &carry_in).await?
} else {
one_bit_adder(c, record_id, &S::ZERO, &self.sum[i], &carry_in).await?
};
let x = if i < value.len() { &value[i] } else { &zero };
let (sum_bit, carry_out) =
one_bit_adder(c, record_id, x, &self.sum[i], &carry_in).await?;

output_sum.push(sum_bit);
carry_in = carry_out;
Expand Down

0 comments on commit 33aaec4

Please sign in to comment.