2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2021-11-24 12:19:23 -06:00
|
|
|
// compile-flags: -C overflow-checks=off
|
2016-08-04 11:57:57 -05:00
|
|
|
|
2018-05-08 08:10:16 -05:00
|
|
|
// Test that with MIR codegen, overflow checks can be
|
2016-08-04 11:57:57 -05:00
|
|
|
// turned off, even when they're from core::ops::*.
|
|
|
|
|
|
|
|
use std::ops::*;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_eq!(i8::neg(-0x80), -0x80);
|
|
|
|
|
|
|
|
assert_eq!(u8::add(0xff, 1), 0_u8);
|
|
|
|
assert_eq!(u8::sub(0, 1), 0xff_u8);
|
|
|
|
assert_eq!(u8::mul(0xff, 2), 0xfe_u8);
|
|
|
|
assert_eq!(u8::shl(1, 9), 2_u8);
|
|
|
|
assert_eq!(u8::shr(2, 9), 1_u8);
|
|
|
|
}
|