From e3b5b96dc2b90bebf077495fc678bb176c63b8f4 Mon Sep 17 00:00:00 2001 From: Scott Richmond Date: Fri, 6 Jun 2025 00:11:08 -0400 Subject: [PATCH] test out 16 bit operand math --- src/main.rs | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1a16c27..3c3533d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -75,18 +75,23 @@ pub fn run(src: &'static str) { pub fn main() { // env::set_var("RUST_BACKTRACE", "1"); - let src = " -let x = { - match #{:a 1, :b 2, :c 3} with { - #{a} -> :one - #{a, b, :c 3} -> :two - #{a, b, c} -> :three - (1, 2, 3) -> :thing - (4, 5, (6, 7, a)) -> if or (true, false, false, true) then :thing_1 else :thing_2 - ([:a, :b, :c, [:d, [:e, (:f, :g)]]]) -> if or (true, false, false, true) then :thing_1 else :thing_2 - } -} + // let src = " + // let x = { + // match #{:a 1, :b 2, :c 3} with { + // #{a} -> :one + // #{a, b, :c 3} -> :two + // #{a, b, c} -> :three + // (1, 2, 3) -> :thing + // (4, 5, (6, 7, a)) -> if or (true, false, false, true) then :thing_1 else :thing_2 + // ([:a, :b, :c, [:d, [:e, (:f, :g)]]]) -> if or (true, false, false, true) then :thing_1 else :thing_2 + // } + // } - "; - run(src); + // "; + // run(src); + let a: u16 = 14261; + let b_high: u8 = (a >> 8) as u8; + let b_low: u8 = a as u8; + let c: u16 = ((b_high as u16) << 8) + b_low as u16; + println!("{a} // {b_high}/{b_low} // {c}"); }