nandi/rustnimpublic Fork 0
3d4a7d283b83d3a5305dfc6654c290bd4ee162ae
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.

005-base16ct-decode-core.rs · 18 lines · 515 BRust Blame HistoryRaw
Add the differential test runner, and a lowering to measure with it 8ac32af nandithebull 13h ago1// The exact expression from base16ct 1.0.0 that the other transpiler's
2// float64 universal AST cannot represent. Milestone 1 in miniature.
3fn decode_nibble(src: u8) -> i16 {
4 let byte = src as i16;
5 let mut ret: i16 = -1;
6 ret += (((0x2fi16 - byte) & (byte - 0x3a)) >> 8) & (byte - 47);
7 ret += (((0x60i16 - byte) & (byte - 0x67)) >> 8) & (byte - 86);
8 ret
9}
10
11fn main() {
12 let mut i: u8 = 0;
13 while i < 128 {
14 print!("{} ", decode_nibble(i));
15 i += 1;
16 }
17 println!("");
18}