Rename Numeric
export to Integer
This commit is contained in:
parent
627927d366
commit
bdb4420292
@ -426,7 +426,7 @@ NUM_ZERO = from_u64(0)
|
|||||||
NUM_ONE = from_u64(1)
|
NUM_ONE = from_u64(1)
|
||||||
NUM_BIT_26 = from_u64(0x4000000)
|
NUM_BIT_26 = from_u64(0x4000000)
|
||||||
|
|
||||||
Numeric.NUM_ZERO = NUM_ZERO
|
Numeric.ZERO = NUM_ZERO
|
||||||
Numeric.NUM_ONE = NUM_ONE
|
Numeric.ONE = NUM_ONE
|
||||||
|
|
||||||
return table_freeze(Numeric)
|
return table_freeze(Numeric)
|
||||||
|
@ -7,8 +7,8 @@ local bit_and = bit32.band
|
|||||||
local bit_lshift = bit32.lshift
|
local bit_lshift = bit32.lshift
|
||||||
local bit_rshift = bit32.rshift
|
local bit_rshift = bit32.rshift
|
||||||
|
|
||||||
local num_from_u32 = I64.from_u32
|
local num_from_u32 = Integer.from_u32
|
||||||
local num_into_u32 = I64.into_u32
|
local num_into_u32 = Integer.into_u32
|
||||||
|
|
||||||
local function to_i32(num)
|
local function to_i32(num)
|
||||||
if num >= 0x80000000 then
|
if num >= 0x80000000 then
|
||||||
@ -22,16 +22,7 @@ local function no_op(num)
|
|||||||
return num
|
return num
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
module.i64 = Integer
|
||||||
local temp = {}
|
|
||||||
|
|
||||||
temp.ZERO = I64.NUM_ZERO
|
|
||||||
temp.ONE = I64.NUM_ONE
|
|
||||||
|
|
||||||
temp.from_u32 = num_from_u32
|
|
||||||
|
|
||||||
module.i64 = temp
|
|
||||||
end
|
|
||||||
|
|
||||||
do
|
do
|
||||||
local add = {}
|
local add = {}
|
||||||
@ -106,11 +97,11 @@ do
|
|||||||
return to_u32(math_fmod(lhs, rhs))
|
return to_u32(math_fmod(lhs, rhs))
|
||||||
end
|
end
|
||||||
|
|
||||||
add.i64 = I64.add
|
add.i64 = Integer.add
|
||||||
sub.i64 = I64.subtract
|
sub.i64 = Integer.subtract
|
||||||
mul.i64 = I64.multiply
|
mul.i64 = Integer.multiply
|
||||||
div.i64 = I64.divide_signed
|
div.i64 = Integer.divide_signed
|
||||||
div.u64 = I64.divide_unsigned
|
div.u64 = Integer.divide_unsigned
|
||||||
|
|
||||||
function neg.f32(num)
|
function neg.f32(num)
|
||||||
return -num
|
return -num
|
||||||
@ -238,11 +229,11 @@ do
|
|||||||
local ge = {}
|
local ge = {}
|
||||||
local gt = {}
|
local gt = {}
|
||||||
|
|
||||||
local num_is_equal = I64.is_equal
|
local num_is_equal = Integer.is_equal
|
||||||
local num_is_less_signed = I64.is_less_signed
|
local num_is_less_signed = Integer.is_less_signed
|
||||||
local num_is_less_unsigned = I64.is_less_unsigned
|
local num_is_less_unsigned = Integer.is_less_unsigned
|
||||||
local num_is_greater_signed = I64.is_greater_signed
|
local num_is_greater_signed = Integer.is_greater_signed
|
||||||
local num_is_greater_unsigned = I64.is_greater_unsigned
|
local num_is_greater_unsigned = Integer.is_greater_unsigned
|
||||||
|
|
||||||
function le.i32(lhs, rhs)
|
function le.i32(lhs, rhs)
|
||||||
return to_i32(lhs) <= to_i32(rhs)
|
return to_i32(lhs) <= to_i32(rhs)
|
||||||
@ -302,10 +293,10 @@ do
|
|||||||
local bxor = {}
|
local bxor = {}
|
||||||
local bnot = {}
|
local bnot = {}
|
||||||
|
|
||||||
band.i64 = I64.bit_and
|
band.i64 = Integer.bit_and
|
||||||
bor.i64 = I64.bit_or
|
bor.i64 = Integer.bit_or
|
||||||
bxor.i64 = I64.bit_xor
|
bxor.i64 = Integer.bit_xor
|
||||||
bnot.i64 = I64.bit_not
|
bnot.i64 = Integer.bit_not
|
||||||
|
|
||||||
module.band = band
|
module.band = band
|
||||||
module.bor = bor
|
module.bor = bor
|
||||||
@ -343,9 +334,9 @@ do
|
|||||||
return bit_rrotate(lhs, rhs % 32)
|
return bit_rrotate(lhs, rhs % 32)
|
||||||
end
|
end
|
||||||
|
|
||||||
shl.i64 = I64.shift_left
|
shl.i64 = Integer.shift_left
|
||||||
shr.i64 = I64.shift_right_signed
|
shr.i64 = Integer.shift_right_signed
|
||||||
shr.u64 = I64.shift_right_unsigned
|
shr.u64 = Integer.shift_right_unsigned
|
||||||
|
|
||||||
module.shl = shl
|
module.shl = shl
|
||||||
module.shr = shr
|
module.shr = shr
|
||||||
@ -368,11 +359,11 @@ do
|
|||||||
local string_pack = string.pack
|
local string_pack = string.pack
|
||||||
local string_unpack = string.unpack
|
local string_unpack = string.unpack
|
||||||
|
|
||||||
local num_from_u64 = I64.from_u64
|
local num_from_u64 = Integer.from_u64
|
||||||
local num_into_u64 = I64.into_u64
|
local num_into_u64 = Integer.into_u64
|
||||||
|
|
||||||
local num_negate = I64.negate
|
local num_negate = Integer.negate
|
||||||
local num_is_negative = I64.is_negative
|
local num_is_negative = Integer.is_negative
|
||||||
|
|
||||||
function wrap.i32_i64(num)
|
function wrap.i32_i64(num)
|
||||||
local data_1, _ = num_into_u32(num)
|
local data_1, _ = num_into_u32(num)
|
||||||
|
@ -12,10 +12,10 @@ fn do_runtime(lock: &mut dyn Write) -> Result<()> {
|
|||||||
let runtime = codegen_luau::RUNTIME;
|
let runtime = codegen_luau::RUNTIME;
|
||||||
let numeric = codegen_luau::NUMERIC;
|
let numeric = codegen_luau::NUMERIC;
|
||||||
|
|
||||||
writeln!(lock, "local rt = (function()")?;
|
writeln!(lock, "local Integer = (function()")?;
|
||||||
writeln!(lock, "local I64 = (function()")?;
|
|
||||||
writeln!(lock, "{numeric}")?;
|
writeln!(lock, "{numeric}")?;
|
||||||
writeln!(lock, "end)()")?;
|
writeln!(lock, "end)()")?;
|
||||||
|
writeln!(lock, "local rt = (function()")?;
|
||||||
writeln!(lock, "{runtime}")?;
|
writeln!(lock, "{runtime}")?;
|
||||||
writeln!(lock, "end)()")
|
writeln!(lock, "end)()")
|
||||||
}
|
}
|
||||||
|
@ -153,10 +153,10 @@ impl Target for Luau {
|
|||||||
let runtime = codegen_luau::RUNTIME;
|
let runtime = codegen_luau::RUNTIME;
|
||||||
let numeric = codegen_luau::NUMERIC;
|
let numeric = codegen_luau::NUMERIC;
|
||||||
|
|
||||||
writeln!(w, "local rt = (function()")?;
|
writeln!(w, "local Integer = (function()")?;
|
||||||
writeln!(w, "local I64 = (function()")?;
|
|
||||||
writeln!(w, "{numeric}")?;
|
writeln!(w, "{numeric}")?;
|
||||||
writeln!(w, "end)()")?;
|
writeln!(w, "end)()")?;
|
||||||
|
writeln!(w, "local rt = (function()")?;
|
||||||
writeln!(w, "{runtime}")?;
|
writeln!(w, "{runtime}")?;
|
||||||
writeln!(w, "end)()")?;
|
writeln!(w, "end)()")?;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user