Skip to content

Commit

Permalink
debug for testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
rw0x0 committed Jan 22, 2025
1 parent 7e415c9 commit edd980b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion iris-mpc-gpu/tests/bucket_threshold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ mod bucket_threshold_test {
let mod_ = 1u64 << (16 + B_BITS);
let mut res = Vec::with_capacity(code_input.len());
for (c, m) in code_input.into_iter().zip(mask_input) {
let r = ((m as u64) * A - ((c as u64) << B_BITS) - 1) % mod_;
let r = (((m as u64) * A).wrapping_sub(((c as u64) << B_BITS).wrapping_sub(1))) % mod_;
let msb = r >> (B_BITS + 16 - 1) & 1 == 1;
res.push(msb)
}
Expand Down
3 changes: 2 additions & 1 deletion iris-mpc-gpu/tests/buckets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ mod buckets_test {

let mut count = 0;
for (c, m) in code_input.iter().cloned().zip(mask_input.iter().cloned()) {
let r = ((m as u64) * a - ((c as u64) << B_BITS) - 1) % mod_;
let r =
(((m as u64) * a).wrapping_sub(((c as u64) << B_BITS).wrapping_sub(1))) % mod_;
let msb = r >> (B_BITS + 16 - 1) & 1 == 1;
count += msb as u32;
}
Expand Down
4 changes: 2 additions & 2 deletions iris-mpc-gpu/tests/one_bucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ mod one_bucket_test {
fn rep_share<R: Rng>(value: u16, rng: &mut R) -> (u16, u16, u16) {
let a = rng.gen();
let b = rng.gen();
let c= value.wrapping_sub(a).wrapping_sub(b);
let c = value.wrapping_sub(a).wrapping_sub(b);

(a, b, c)
}
Expand Down Expand Up @@ -94,7 +94,7 @@ mod one_bucket_test {
let mod_ = 1u64 << (16 + B_BITS);
let mut count = 0;
for (c, m) in code_input.into_iter().zip(mask_input) {
let r = ((m as u64) * A - ((c as u64) << B_BITS) - 1) % mod_;
let r = (((m as u64) * A).wrapping_sub(((c as u64) << B_BITS).wrapping_sub(1))) % mod_;
let msb = r >> (B_BITS + 16 - 1) & 1 == 1;
count += msb as u32;
}
Expand Down
4 changes: 2 additions & 2 deletions iris-mpc-gpu/tests/threshold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ mod threshold_test {
fn rep_share<R: Rng>(value: u16, rng: &mut R) -> (u16, u16, u16) {
let a = rng.gen();
let b = rng.gen();
let c= value.wrapping_sub(a).wrapping_sub(b);
let c = value.wrapping_sub(a).wrapping_sub(b);

(a, b, c)
}
Expand Down Expand Up @@ -110,7 +110,7 @@ mod threshold_test {
let mod_ = 1u64 << (16 + B_BITS);
let mut res = Vec::with_capacity(code_input.len());
for (c, m) in code_input.into_iter().zip(mask_input) {
let r = ((m as u64) * A - ((c as u64) << B_BITS) - 1) % mod_;
let r = (((m as u64) * A).wrapping_sub(((c as u64) << B_BITS).wrapping_sub(1))) % mod_;
let msb = r >> (B_BITS + 16 - 1) & 1 == 1;
res.push(msb)
}
Expand Down
4 changes: 2 additions & 2 deletions iris-mpc-gpu/tests/threshold_and_or_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ mod test_threshold_and_or_tree_test {
fn rep_share<R: Rng>(value: u16, rng: &mut R) -> (u16, u16, u16) {
let a = rng.gen();
let b = rng.gen();
let c= value.wrapping_sub(a).wrapping_sub(b);
let c = value.wrapping_sub(a).wrapping_sub(b);

(a, b, c)
}
Expand Down Expand Up @@ -93,7 +93,7 @@ mod test_threshold_and_or_tree_test {
let mod_ = 1u64 << (16 + B_BITS);
let mut res = false;
for (c, m) in code_input.into_iter().zip(mask_input) {
let r = ((m as u64) * A - ((c as u64) << B_BITS) - 1) % mod_;
let r = (((m as u64) * A).wrapping_sub(((c as u64) << B_BITS).wrapping_sub(1))) % mod_;
let msb = r >> (B_BITS + 16 - 1) & 1 == 1;
res |= msb;
}
Expand Down

0 comments on commit edd980b

Please sign in to comment.