Skip to content

Commit abd9905

Browse files
quaternictgross35
authored andcommitted
libm: fix test for overflow in u256::shr
1 parent 22c27f8 commit abd9905

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

libm/src/math/support/big/tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ fn shr_u256_overflow() {
269269
#[test]
270270
#[cfg(not(debug_assertions))]
271271
fn shr_u256_overflow() {
272-
// No panic without debug assertions
273-
assert_eq!(u256::MAX >> 256, u256::ZERO);
274-
assert_eq!(u256::MAX >> 257, u256::ZERO);
275-
assert_eq!(u256::MAX >> u32::MAX, u256::ZERO);
272+
// Without debug assertions, the shift amount is wrapped
273+
assert_eq!(u256::MAX >> 256, u256::MAX);
274+
assert_eq!(u256::MAX >> 257, u256::MAX >> 1);
275+
assert_eq!(u256::MAX >> u32::MAX, u256::ONE);
276276
}
277277

278278
#[test]

0 commit comments

Comments
 (0)