mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-08 15:34:09 +00:00
backport table.move from 5.3
This commit is contained in:
parent
8e5d7bec0d
commit
4dc6c3932f
@ -15,7 +15,12 @@ static const uint8_t libbc_code[] = {
|
|||||||
8,2,0,0,88,3,23,128,59,3,2,0,43,4,0,0,64,4,2,0,76,3,2,0,88,3,18,128,16,1,14,
|
8,2,0,0,88,3,23,128,59,3,2,0,43,4,0,0,64,4,2,0,76,3,2,0,88,3,18,128,16,1,14,
|
||||||
0,41,3,1,0,3,3,1,0,88,3,14,128,3,1,2,0,88,3,12,128,59,3,1,0,22,4,1,1,18,5,2,
|
0,41,3,1,0,3,3,1,0,88,3,14,128,3,1,2,0,88,3,12,128,59,3,1,0,22,4,1,1,18,5,2,
|
||||||
0,41,6,1,0,77,4,4,128,23,8,1,7,59,9,7,0,64,9,8,0,79,4,252,127,43,4,0,0,64,4,
|
0,41,6,1,0,77,4,4,128,23,8,1,7,59,9,7,0,64,9,8,0,79,4,252,127,43,4,0,0,64,4,
|
||||||
2,0,76,3,2,0,75,0,1,0,0,2,0
|
2,0,76,3,2,0,75,0,1,0,0,2,0,5,10,0,0,1,38,16,0,12,0,16,1,14,0,16,2,14,0,16,
|
||||||
|
3,14,0,10,4,0,0,88,5,2,128,14,0,4,0,88,5,1,128,18,4,0,0,16,4,12,0,3,1,2,0,88,
|
||||||
|
5,25,128,0,2,3,0,88,5,4,128,2,3,1,0,88,5,2,128,4,4,0,0,88,5,9,128,18,5,1,0,
|
||||||
|
18,6,2,0,41,7,1,0,77,5,4,128,59,9,8,0,64,9,3,4,22,3,0,3,79,5,252,127,88,5,10,
|
||||||
|
128,32,5,2,3,33,3,1,5,18,5,2,0,18,6,1,0,41,7,255,255,77,5,4,128,59,9,8,0,64,
|
||||||
|
9,3,4,23,3,0,3,79,5,252,127,76,4,2,0,2,0
|
||||||
#else
|
#else
|
||||||
0,1,2,0,0,1,2,24,1,0,0,76,1,2,0,241,135,158,166,3,220,203,178,130,4,0,1,2,0,
|
0,1,2,0,0,1,2,24,1,0,0,76,1,2,0,241,135,158,166,3,220,203,178,130,4,0,1,2,0,
|
||||||
0,1,2,24,1,0,0,76,1,2,0,243,244,148,165,20,198,190,199,252,3,0,1,2,0,0,0,3,
|
0,1,2,24,1,0,0,76,1,2,0,243,244,148,165,20,198,190,199,252,3,0,1,2,0,0,0,3,
|
||||||
@ -28,7 +33,12 @@ static const uint8_t libbc_code[] = {
|
|||||||
8,2,0,0,88,3,23,128,59,3,2,0,43,4,0,0,64,4,2,0,76,3,2,0,88,3,18,128,16,1,14,
|
8,2,0,0,88,3,23,128,59,3,2,0,43,4,0,0,64,4,2,0,76,3,2,0,88,3,18,128,16,1,14,
|
||||||
0,41,3,1,0,3,3,1,0,88,3,14,128,3,1,2,0,88,3,12,128,59,3,1,0,22,4,1,1,18,5,2,
|
0,41,3,1,0,3,3,1,0,88,3,14,128,3,1,2,0,88,3,12,128,59,3,1,0,22,4,1,1,18,5,2,
|
||||||
0,41,6,1,0,77,4,4,128,23,8,1,7,59,9,7,0,64,9,8,0,79,4,252,127,43,4,0,0,64,4,
|
0,41,6,1,0,77,4,4,128,23,8,1,7,59,9,7,0,64,9,8,0,79,4,252,127,43,4,0,0,64,4,
|
||||||
2,0,76,3,2,0,75,0,1,0,0,2,0
|
2,0,76,3,2,0,75,0,1,0,0,2,0,5,10,0,0,1,38,16,0,12,0,16,1,14,0,16,2,14,0,16,
|
||||||
|
3,14,0,10,4,0,0,88,5,2,128,14,0,4,0,88,5,1,128,18,4,0,0,16,4,12,0,3,1,2,0,88,
|
||||||
|
5,25,128,0,2,3,0,88,5,4,128,2,3,1,0,88,5,2,128,4,4,0,0,88,5,9,128,18,5,1,0,
|
||||||
|
18,6,2,0,41,7,1,0,77,5,4,128,59,9,8,0,64,9,3,4,22,3,0,3,79,5,252,127,88,5,10,
|
||||||
|
128,32,5,2,3,33,3,1,5,18,5,2,0,18,6,1,0,41,7,255,255,77,5,4,128,59,9,8,0,64,
|
||||||
|
9,3,4,23,3,0,3,79,5,252,127,76,4,2,0,2,0
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -40,6 +50,7 @@ static const struct { const char *name; int ofs; } libbc_map[] = {
|
|||||||
{"table_foreach",136},
|
{"table_foreach",136},
|
||||||
{"table_getn",207},
|
{"table_getn",207},
|
||||||
{"table_remove",226},
|
{"table_remove",226},
|
||||||
{NULL,355}
|
{"table_move",355},
|
||||||
|
{NULL,515}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -129,6 +129,38 @@ LJLIB_LUA(table_remove) /*
|
|||||||
end
|
end
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copy elements (a1[f], ..., a1[e]) into (a2[t], a2[t+1], ...). Whenever
|
||||||
|
** possible, copy in increasing order, which is better for rehashing.
|
||||||
|
** "possible" means destination after original range, or smaller
|
||||||
|
** than origin, or copying to another table.
|
||||||
|
*/
|
||||||
|
LJLIB_LUA(table_move) /*
|
||||||
|
function(a1, f, e, t, a2)
|
||||||
|
CHECK_tab(a1)
|
||||||
|
CHECK_int(f)
|
||||||
|
CHECK_int(e)
|
||||||
|
CHECK_int(t)
|
||||||
|
a2 = (a2 ~= nil) and a2 or a1
|
||||||
|
CHECK_tab(a2)
|
||||||
|
if e >= f then
|
||||||
|
if t > e or t <= f or a2 ~= a1 then
|
||||||
|
for i = f, e do
|
||||||
|
a2[t] = a1[i]
|
||||||
|
t = t + 1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
t = t + e - f
|
||||||
|
for i = e, f, -1 do
|
||||||
|
a2[t] = a1[i]
|
||||||
|
t = t - 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return a2
|
||||||
|
end
|
||||||
|
*/
|
||||||
|
|
||||||
LJLIB_CF(table_concat) LJLIB_REC(.)
|
LJLIB_CF(table_concat) LJLIB_REC(.)
|
||||||
{
|
{
|
||||||
GCtab *t = lj_lib_checktab(L, 1);
|
GCtab *t = lj_lib_checktab(L, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user