diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2019-07-24 13:16:36 +0200 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2019-07-26 11:30:39 +0200 |
| commit | 63b82238bbe54643c63a8693299d6a9f4c0b0358 (patch) | |
| tree | 06d7c44095f40107fe0aaa321f096a86fb5731d7 /example/std_example.rs | |
| parent | 4d35be684da8c82ac699093132bda4a5292f9578 (diff) | |
| download | rust-63b82238bbe54643c63a8693299d6a9f4c0b0358.tar.gz rust-63b82238bbe54643c63a8693299d6a9f4c0b0358.zip | |
Implement 128bit checked add and sub
Diffstat (limited to 'example/std_example.rs')
| -rw-r--r-- | example/std_example.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/example/std_example.rs b/example/std_example.rs index 9e9a7a67e05..f9fc1f2cde3 100644 --- a/example/std_example.rs +++ b/example/std_example.rs @@ -23,6 +23,9 @@ fn main() { checked_div_u128(0u128, 2u128); assert_eq!(1u128 + 2, 3); + // overflow panic + // 0xFEDCBA987654321123456789ABCDEFu128 + 0xFEDCBA987654321123456789ABCDEFu128; + println!("{}", 0b100010000000000000000000000000000u128 >> 10); println!("{}", 0xFEDCBA987654321123456789ABCDEFu128 >> 64); println!("{} >> 64 == {}", 0xFEDCBA987654321123456789ABCDEFu128 as i128, 0xFEDCBA987654321123456789ABCDEFu128 as i128 >> 64); |
