Fix software integer instantiation
This commit is contained in:
parent
1939fbb248
commit
99e74e7ea1
@ -21,14 +21,14 @@ local function no_op(num)
|
||||
end
|
||||
|
||||
do
|
||||
local num = {}
|
||||
local temp = {}
|
||||
|
||||
num.K_ZERO = I64.K_ZERO
|
||||
num.K_ONE = I64.K_ONE
|
||||
temp.K_ZERO = I64.K_ZERO
|
||||
temp.K_ONE = I64.K_ONE
|
||||
|
||||
num.from_u32 = num_from_u32
|
||||
temp.from_u32 = num_from_u32
|
||||
|
||||
module.num = num
|
||||
module.i64 = temp
|
||||
end
|
||||
|
||||
do
|
||||
|
@ -32,7 +32,7 @@ impl Visitor for Visit {
|
||||
_ => return,
|
||||
};
|
||||
|
||||
self.result.insert(("num", name));
|
||||
self.result.insert(("i64", name));
|
||||
}
|
||||
|
||||
fn visit_un_op(&mut self, v: &UnOp) {
|
||||
|
@ -93,14 +93,14 @@ pub fn write_i32(number: i32, w: &mut dyn Write) -> Result<()> {
|
||||
|
||||
fn write_i64(number: i64, w: &mut dyn Write) -> Result<()> {
|
||||
match number {
|
||||
0 => write!(w, "num_K_ZERO "),
|
||||
1 => write!(w, "num_K_ONE "),
|
||||
0 => write!(w, "i64_K_ZERO "),
|
||||
1 => write!(w, "i64_K_ONE "),
|
||||
_ => {
|
||||
let list = number.to_ne_bytes();
|
||||
let a = u32::from_ne_bytes(list[0..4].try_into().unwrap());
|
||||
let b = u32::from_ne_bytes(list[4..8].try_into().unwrap());
|
||||
|
||||
write!(w, "num_from_u32({a}, {b}) ")
|
||||
write!(w, "i64_from_u32({a}, {b}) ")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ fn write_variable_list(ast: &FuncData, w: &mut dyn Write) -> Result<()> {
|
||||
for data in ast.local_data.iter().filter(|v| v.count() != 0) {
|
||||
let range = total..total + usize::try_from(data.count()).unwrap();
|
||||
let zero = if data.value_type() == ValueType::I64 {
|
||||
"num_K_ZERO "
|
||||
"i64_K_ZERO "
|
||||
} else {
|
||||
"0 "
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ impl Luau {
|
||||
let data_1 = (data & 0xFFFFFFFF) as u32;
|
||||
let data_2 = (data >> 32 & 0xFFFFFFFF) as u32;
|
||||
|
||||
write!(w, "{{{data_1}, {data_2}}}")
|
||||
write!(w, "rt.i64.from_u32({data_1}, {data_2})")
|
||||
}
|
||||
|
||||
fn write_expression(data: &Expression, w: &mut dyn Write) -> Result<()> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user