Browse Source

fix nat_binop abusing a rustc bug

master
Alison Watson 2 years ago
parent
commit
25551cd2da
  1. 14
      source/framework/vire/compiler/nat.rs

14
source/framework/vire/compiler/nat.rs

@ -2,10 +2,10 @@ use super::*;
use blonkus_ma::nat_call;
macro_rules! nat_binop {
( $id:literal , $name:ident , $op:expr ) => {
( $id:literal , $name:ident , $op:tt ) => {
#[nat_call($id, (i64) |i64, i64| -> i64)]
fn $name(x: i64, y: i64) -> i64 {
$op
x $op y
}
};
}
@ -15,10 +15,10 @@ fn dbgi(n: i64) {
eprintln!("{}", n);
}
nat_binop!("i+", addi, x + y);
nat_binop!("i-", subi, x - y);
nat_binop!("i*", muli, x * y);
nat_binop!("i/", divi, x / y);
nat_binop!("i%", remi, x % y);
nat_binop!("i+", addi, +);
nat_binop!("i-", subi, -);
nat_binop!("i*", muli, *);
nat_binop!("i/", divi, /);
nat_binop!("i%", remi, %);
// EOF

Loading…
Cancel
Save