]> git.lizzy.rs Git - rust.git/commitdiff
Fix test for 32-bit targets.
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Fri, 17 Apr 2015 00:03:38 +0000 (02:03 +0200)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Fri, 17 Apr 2015 00:03:38 +0000 (02:03 +0200)
(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.)

src/test/run-pass/wrapping-int-api.rs

index 5d1d6919f5204192bde609cff810bd32b641ed30..e195d624fe529758cdbd26aa9194126142e2b99c 100644 (file)
@@ -101,13 +101,13 @@ macro_rules! check_mul_wraps {
     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);