Browse Source

fix nat_binop abusing a rustc bug

master
Alison Watson 5 months ago
parent
commit
25551cd2da
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      source/framework/vire/compiler/nat.rs

+ 7
- 7
source/framework/vire/compiler/nat.rs View File

@@ -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