diff --git a/src/biguint/shift.rs b/src/biguint/shift.rs index 9fbeb02e..00326bb5 100644 --- a/src/biguint/shift.rs +++ b/src/biguint/shift.rs @@ -35,7 +35,7 @@ fn biguint_shl2(n: Cow<'_, BigUint>, digits: usize, shift: u8) -> BigUint { if shift > 0 { let mut carry = 0; - let carry_shift = big_digit::BITS as u8 - shift; + let carry_shift = big_digit::BITS - shift; for elem in data[digits..].iter_mut() { let new_carry = *elem >> carry_shift; *elem = (*elem << shift) | carry; @@ -79,7 +79,7 @@ fn biguint_shr2(n: Cow<'_, BigUint>, digits: usize, shift: u8) -> BigUint { if shift > 0 { let mut borrow = 0; - let borrow_shift = big_digit::BITS as u8 - shift; + let borrow_shift = big_digit::BITS - shift; for elem in data.iter_mut().rev() { let new_borrow = *elem << borrow_shift; *elem = (*elem >> shift) | borrow; diff --git a/tests/bigint.rs b/tests/bigint.rs index 3144367f..75cf81ec 100644 --- a/tests/bigint.rs +++ b/tests/bigint.rs @@ -187,7 +187,7 @@ fn test_signed_bytes_le_round_trip() { #[test] fn test_cmp() { - let vs: [&[u32]; 4] = [&[2 as u32], &[1, 1], &[2, 1], &[1, 1, 1]]; + let vs: [&[u32]; 4] = [&[2_u32], &[1, 1], &[2, 1], &[1, 1, 1]]; let mut nums = Vec::new(); for s in vs.iter().rev() { nums.push(BigInt::from_slice(Minus, *s));