nandi/rustnimpublic Fork 0
99b837678a29fedd20bb68a5117a6621d8d178b4
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.

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