From e5fb05b706e8195e7a0e382beb7b20f7bdc9c0e9 Mon Sep 17 00:00:00 2001 From: Rerumu Date: Thu, 30 Jun 2022 14:09:36 -0400 Subject: [PATCH] Remove some more proxies --- codegen/luajit/runtime/runtime.lua | 6 ------ codegen/luajit/src/translator.rs | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/codegen/luajit/runtime/runtime.lua b/codegen/luajit/runtime/runtime.lua index d383f91..4cb368c 100644 --- a/codegen/luajit/runtime/runtime.lua +++ b/codegen/luajit/runtime/runtime.lua @@ -322,8 +322,6 @@ do trunc.i32_f32 = truncate trunc.i32_f64 = truncate - trunc.u32_f32 = math_floor - trunc.u32_f64 = math_floor trunc.i64_f32 = i64 trunc.i64_f64 = i64 trunc.u64_f32 = i64 @@ -398,8 +396,6 @@ do return (to_number(u32(num))) end - convert.f32_i64 = to_number - function convert.f32_u64(num) return (to_number(u64(num))) end @@ -412,8 +408,6 @@ do return (to_number(u32(num))) end - convert.f64_i64 = to_number - function convert.f64_u64(num) return (to_number(u64(num))) end diff --git a/codegen/luajit/src/translator.rs b/codegen/luajit/src/translator.rs index f741cff..b5fbcba 100644 --- a/codegen/luajit/src/translator.rs +++ b/codegen/luajit/src/translator.rs @@ -227,6 +227,8 @@ fn write_local_operation(head: &str, tail: &str, w: &mut dyn Write) -> Result<() ("shr", "u32" | "u64") => write!(w, "bit.rshift "), ("rotl", _) => write!(w, "bit.rol "), ("rotr", _) => write!(w, "bit.ror "), + ("trunc", "u32_f32" | "u32_f64") => write!(w, "math.floor "), + ("convert", "f32_i64" | "f64_i64") => write!(w, "tonumber "), _ => write!(w, "rt.{head}.{tail} "), } }