Skip to content

Commit

Permalink
Merge pull request #81 from bitcartel/52_wrapped_shr
Browse files Browse the repository at this point in the history
Closes #52. Fix test error "attempt to shift right with overflow".
  • Loading branch information
str4d authored May 28, 2019
2 parents c5642f9 + 437b66d commit 2d97ccb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sapling-crypto/src/circuit/uint32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,9 @@ mod test {
for i in 0..60 {
let num = rng.gen();
let a = UInt32::constant(num).shr(i);
let b = UInt32::constant(num >> i);
let b = UInt32::constant(num.wrapping_shr(i as u32));

assert_eq!(a.value.unwrap(), num >> i);
assert_eq!(a.value.unwrap(), num.wrapping_shr(i as u32));

assert_eq!(a.bits.len(), b.bits.len());
for (a, b) in a.bits.iter().zip(b.bits.iter()) {
Expand Down

0 comments on commit 2d97ccb

Please sign in to comment.