nandi/rustnimpublic Fork 0
ae9f986fc43d0fc9ab029946e2c7a25cdc72b4ed
Commits
Clone
git clone https://git.rickub.com/nandi/rustnim.git
git clone ssh://git@rickub.com/nandi/rustnim.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Add the differential test runner, and a lowering to measure with it 8ac32af · on ae9f986fc43d0fc9ab029946e2c7a25cdc72b4ed · nandithebull · 17h ago
003-unsigned-wrapping.rs · 10 lines · 362 BRust Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
// DESIGN.md item 2: Nim's fixed-width unsigned arithmetic wraps silently,
// matching Rust's wrapping_*, so these map to bare operators.
fn main() {
    let a: u8 = 200;
    println!("{}", a.wrapping_add(100));
    println!("{}", a.wrapping_sub(250));
    println!("{}", a.wrapping_mul(3));
    let b: u32 = 4294967295;
    println!("{}", b.wrapping_add(2));
}