From b7cfd3d405d94a44c04abb84a536a708d066cfc3 Mon Sep 17 00:00:00 2001 From: Someon1e <142684596+Someon1e@users.noreply.github.com> Date: Sun, 3 Mar 2024 21:08:25 +0000 Subject: [PATCH] Take advantage of inlining --- codegen/luau/runtime/numeric_v3.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/codegen/luau/runtime/numeric_v3.lua b/codegen/luau/runtime/numeric_v3.lua index ea20578..300d57c 100644 --- a/codegen/luau/runtime/numeric_v3.lua +++ b/codegen/luau/runtime/numeric_v3.lua @@ -20,7 +20,7 @@ local bit_replace = bit32.replace local from_u32, from_u64, into_u64 local num_subtract, num_divide_unsigned, num_negate local num_or, num_shift_left, num_shift_right_unsigned -local num_is_negative, num_is_zero, num_is_less_unsigned +local num_is_less_unsigned -- X: a[0 ..21] -- Y: a[22..31] @@ -36,6 +36,10 @@ function Numeric.from_u32(data_1, data_2) return constructor(x, y, z) end +local function num_is_zero(value) + return value == NUM_ZERO +end + local function load_d1(value) return bit_replace(bit_and(value.X, 0x3FFFFF), value.Z, 22, 10) end @@ -180,6 +184,10 @@ function Numeric.divide_unsigned(lhs, rhs) return quotient, remainder end +local function num_is_negative(value) + return value.Z >= 0x80000 +end + function Numeric.divide_signed(lhs, rhs) local left_negative = num_is_negative(lhs) local right_negative = num_is_negative(rhs) @@ -336,14 +344,6 @@ function Numeric.rotate_right(lhs, rhs) end end -function Numeric.is_negative(value) - return value.Z >= 0x80000 -end - -function Numeric.is_zero(value) - return value == NUM_ZERO -end - function Numeric.is_equal(lhs, rhs) return lhs == rhs end @@ -400,8 +400,8 @@ num_or = Numeric.bit_or num_shift_left = Numeric.shift_left num_shift_right_unsigned = Numeric.shift_right_unsigned -num_is_negative = Numeric.is_negative -num_is_zero = Numeric.is_zero +Numeric.is_negative = num_is_negative +Numeric.is_zero = num_is_zero num_is_less_unsigned = Numeric.is_less_unsigned NUM_ONE = from_u64(1)