mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
const-int-wrapping.rs += wrapping_neg
This commit is contained in:
parent
5256efb800
commit
31bf7e1b51
@ -13,6 +13,9 @@ const SHL_B: u32 = 1u32.wrapping_shl(128);
|
||||
const SHR_A: u32 = 128u32.wrapping_shr(7);
|
||||
const SHR_B: u32 = 128u32.wrapping_shr(128);
|
||||
|
||||
const NEG_A: u32 = 5u32.wrapping_neg();
|
||||
const NEG_B: u32 = 1234567890u32.wrapping_neg();
|
||||
|
||||
fn ident<T>(ident: T) -> T {
|
||||
ident
|
||||
}
|
||||
@ -30,6 +33,6 @@ fn main() {
|
||||
assert_eq!(SHL_A, ident(128));
|
||||
assert_eq!(SHL_B, ident(1));
|
||||
|
||||
assert_eq!(SHR_A, ident(1));
|
||||
assert_eq!(SHR_B, ident(128));
|
||||
assert_eq!(SHR_A, ident(4294967291));
|
||||
assert_eq!(SHR_B, ident(3060399406));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user