interplane.Get Omega
Read in your language

omega-bridge

Omega-first language interoperability: checked conversion backends and native language bindings

Brought by drakestapleton

branch main Branches Tags History

omega-bridge / tests / native / g1 / caller.rs

14 lines · 600 bytes Raw Blame History
1// Rust caller for the G1 sample calc: reads "i0 i1" lines, prints "i0 i1 status result" per line.
2mod omega_native; // generated by tools/native, nothing typed by hand
3use std::io::BufRead;
4
5fn main() {
6 for line in std::io::stdin().lock().lines() {
7 let line = line.expect("stdin");
8 let mut it = line.split_whitespace().map(|t| t.parse::<u64>().expect("u64"));
9 let (a, b) = (it.next().expect("i0"), it.next().expect("i1"));
10 let mut r: u64 = 0;
11 let s = unsafe { omega_native::omega_calc(&mut r, a, b) };
12 println!("{} {} {} {}", a, b, s, r);
13 }
14}