Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
andyleiserson committed Feb 23, 2024
1 parent 38e2461 commit fb191e0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
8 changes: 0 additions & 8 deletions ipa-core/src/ff/boolean_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ macro_rules! impl_serializable_trait {

#[cfg(all(test, unit_test))]
mod fallible_serialization_tests {
use rand::{thread_rng, Rng};

use super::*;

/// [`https://github.com/private-attribution/ipa/issues/911`]
Expand All @@ -197,8 +195,6 @@ macro_rules! impl_serializable_trait {
"Padding only makes sense for lengths that are not multiples of 8."
);

let mut rng = thread_rng();

let mut non_zero_padding = $name::ZERO.0;
non_zero_padding.set($bits, true);
assert_eq!(
Expand All @@ -212,10 +208,6 @@ macro_rules! impl_serializable_trait {
let mut max_value = $name::ZERO.0;
max_value[..$bits].fill(true);
deserialize(max_value).unwrap();

let mut rnd_value = $name::ZERO.0;
rnd_value[..$bits].fill_with(|_| rng.gen());
deserialize(rnd_value).unwrap();
}
}
};
Expand Down
6 changes: 3 additions & 3 deletions ipa-core/src/protocol/basics/if_else.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ where
C: Context,
B: Clone + BooleanArrayMul,
{
let false_value = false_value.clone().into();
let true_value = true_value.clone().into();
let condition = B::expand(condition).into();
let false_value = B::Vectorized::from(false_value.clone());
let true_value = B::Vectorized::from(true_value.clone());
let condition = B::Vectorized::from(B::expand(condition));
// If `condition` is a share of 1 (true), then
// false_value + condition * (true_value - false_value)
// = false_value + true_value - false_value
Expand Down
9 changes: 4 additions & 5 deletions ipa-core/src/protocol/basics/mul/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,12 @@ use semi_honest::multiply as semi_honest_mul;
// breakdown key type BK is BA8) can invoke vectorized multiply. Without this trait, those
// implementations would need to specify the `N` const parameter, which is tricky, because you
// can't supply an expression involving a type parameter (BK::BITS) as a const parameter.
pub trait BooleanArrayMul:
Expand<Input = Replicated<Boolean>> + From<Self::Vectorized> + Into<Self::Vectorized>
{
type Vectorized: Send
+ Sync
pub trait BooleanArrayMul: Expand<Input = Replicated<Boolean>> + From<Self::Vectorized> {
type Vectorized: From<Self>
+ for<'a> Add<&'a Self::Vectorized, Output = Self::Vectorized>
+ for<'a> Sub<&'a Self::Vectorized, Output = Self::Vectorized>
+ Send
+ Sync
+ 'static;

fn multiply<'fut, C>(
Expand Down

0 comments on commit fb191e0

Please sign in to comment.