You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/code/ConstSpecialization.lua.base
+3-11Lines changed: 3 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -72,20 +72,12 @@ else
72
72
function rshift(a, b) return math.floor(a / (2 ^ b)) end
73
73
end
74
74
75
-
-- Core runtime functions
75
+
-- Core runtime functions (simple builtins like eps, pi, clip, real, int, bool are inlined)
76
76
function ifExpressionValue(cond,then_,else_) if cond then return then_ else return else_ end end
77
77
function ifExpression(cond,then_,else_) if cond then return then_() else return else_() end end
78
-
function eps() return 1e-18 end
79
-
function pi() return 3.1415926535897932384 end
80
78
function random() return math.random() end
81
79
function irandom() return math.floor(math.random() * 4294967296) end
82
-
function clip(x,low,high) if x > high then return high else if x < low then return low else return x end end end
83
-
function real(x) return x end
84
-
function int(x) if type(x) == "boolean" then x = x and 1 or 0 end local int_part,_ = math.modf(x) return int_part end
85
-
function int16(x) if type(x) == "boolean" then x = x and 1 or 0 end local int_part,_ = math.modf(x) return math.max(-32768, math.min(32767, int_part)) end
86
-
function bool(x) return x ~= 0 and x ~= false end
87
-
function set(a, i, v) a[i+1]=v end
88
-
function get(a, i) return a[i+1] end
80
+
function int16(x) local int_part,_ = math.modf(x) return math.max(-32768, math.min(32767, int_part)) end
89
81
function intDiv(a, b) return math.floor(a / b) end
90
82
function list_clear(t) for k in pairs(t) do t[k] = nil end end
91
83
@@ -264,7 +256,7 @@ function ConstSpecialization_setMatrix2(m, row, col, value)
264
256
end
265
257
266
258
function ConstSpecialization_getMatrix2(m, row, col)
267
-
return get(m, (row + lshift(col, 1)))
259
+
return m[((row + lshift(col, 1))) + 1]
268
260
end
269
261
270
262
function ConstSpecialization_test_matrix_mutation(m, x)
Copy file name to clipboardExpand all lines: test/code/Constants.lua.base
+2-10Lines changed: 2 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -72,20 +72,12 @@ else
72
72
function rshift(a, b) return math.floor(a / (2 ^ b)) end
73
73
end
74
74
75
-
-- Core runtime functions
75
+
-- Core runtime functions (simple builtins like eps, pi, clip, real, int, bool are inlined)
76
76
function ifExpressionValue(cond,then_,else_) if cond then return then_ else return else_ end end
77
77
function ifExpression(cond,then_,else_) if cond then return then_() else return else_() end end
78
-
function eps() return 1e-18 end
79
-
function pi() return 3.1415926535897932384 end
80
78
function random() return math.random() end
81
79
function irandom() return math.floor(math.random() * 4294967296) end
82
-
function clip(x,low,high) if x > high then return high else if x < low then return low else return x end end end
83
-
function real(x) return x end
84
-
function int(x) if type(x) == "boolean" then x = x and 1 or 0 end local int_part,_ = math.modf(x) return int_part end
85
-
function int16(x) if type(x) == "boolean" then x = x and 1 or 0 end local int_part,_ = math.modf(x) return math.max(-32768, math.min(32767, int_part)) end
86
-
function bool(x) return x ~= 0 and x ~= false end
87
-
function set(a, i, v) a[i+1]=v end
88
-
function get(a, i) return a[i+1] end
80
+
function int16(x) local int_part,_ = math.modf(x) return math.max(-32768, math.min(32767, int_part)) end
89
81
function intDiv(a, b) return math.floor(a / b) end
90
82
function list_clear(t) for k in pairs(t) do t[k] = nil end end
0 commit comments