Navigation Menu

Skip to content

Commit

Permalink
Fix test for 32-bit targets.
Browse files Browse the repository at this point in the history
(The cast from the 64-bit value to isize was using the lower 32-bits,
which led to it being treated as a large positive value rather than a
smallish negative one. The fix was to use the same bits for the upper-
and lower- 32 bits.)
  • Loading branch information
pnkfelix committed Apr 17, 2015
1 parent 0610ee4 commit 4f67850
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/test/run-pass/wrapping-int-api.rs
Expand Up @@ -101,13 +101,13 @@ fn main() {
check_mul_no_wrap!(0xfedc_u16 as i16, -2);
check_mul_no_wrap!(0xfedc_ba98_u32 as i32, -2);
check_mul_no_wrap!(0xfedc_ba98_7654_3217_u64 as i64, -2);
check_mul_no_wrap!(0xfedc_ba98_7654_3217_u64 as u64 as isize, -2);
check_mul_no_wrap!(0xfedc_ba98_fedc_ba98_u64 as u64 as isize, -2);

check_mul_no_wrap!(0xfe_u8 as i8, 2);
check_mul_no_wrap!(0xfedc_u16 as i16, 2);
check_mul_no_wrap!(0xfedc_ba98_u32 as i32, 2);
check_mul_no_wrap!(0xfedc_ba98_7654_3217_u64 as i64, 2);
check_mul_no_wrap!(0xfedc_ba98_7654_3217_u64 as u64 as isize, 2);
check_mul_no_wrap!(0xfedc_ba98_fedc_ba98_u64 as u64 as isize, 2);

check_mul_wraps!(0x80_u8 as i8, -1);
check_mul_wraps!(0x8000_u16 as i16, -1);
Expand Down

0 comments on commit 4f67850

Please sign in to comment.