nandi/rustnimpublic Fork 0
af6e50f646055dc5b291c9e602bc9ee01874f9d6
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 af6e50f646055dc5b291c9e602bc9ee01874f9d6 · nandithebull · 18h ago
004-signed-shr.rs · 10 lines · 340 BRust Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
// DESIGN.md item 1: Nim's `shr` on a signed integer is arithmetic, like Rust's
// `>>`. This is the operation base16ct's constant-time decoder depends on.
fn main() {
    let x: i16 = -256;
    println!("{}", x >> 8);
    println!("{}", (-1i32) >> 16);
    let y: u16 = 65280;
    println!("{}", y >> 8);
    println!("{}", 1i32 << 10);
}