mirror of https://github.com/rusefi/lua.git
avoid functions named 'pack'
(name too common, may collide when doing 'onelua.c')
This commit is contained in:
parent
6b01b6cf6a
commit
89da4168df
14
lmathlib.c
14
lmathlib.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lmathlib.c,v 1.124 2018/03/11 14:48:09 roberto Exp roberto $
|
** $Id: lmathlib.c,v 1.125 2018/03/12 12:39:03 roberto Exp roberto $
|
||||||
** Standard mathematical library
|
** Standard mathematical library
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -321,7 +321,7 @@ typedef struct I {
|
||||||
** basic operations on 'I' values
|
** basic operations on 'I' values
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static I pack (lu_int32 h, lu_int32 l) {
|
static I packI (lu_int32 h, lu_int32 l) {
|
||||||
I result;
|
I result;
|
||||||
result.h = h;
|
result.h = h;
|
||||||
result.l = l;
|
result.l = l;
|
||||||
|
@ -330,20 +330,20 @@ static I pack (lu_int32 h, lu_int32 l) {
|
||||||
|
|
||||||
/* i ^ (i << n) */
|
/* i ^ (i << n) */
|
||||||
static I Ixorshl (I i, int n) {
|
static I Ixorshl (I i, int n) {
|
||||||
return pack(i.h ^ ((i.h << n) | (i.l >> (32 - n))), i.l ^ (i.l << n));
|
return packI(i.h ^ ((i.h << n) | (i.l >> (32 - n))), i.l ^ (i.l << n));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* i ^ (i >> n) */
|
/* i ^ (i >> n) */
|
||||||
static I Ixorshr (I i, int n) {
|
static I Ixorshr (I i, int n) {
|
||||||
return pack(i.h ^ (i.h >> n), i.l ^ ((i.l >> n) | (i.h << (32 - n))));
|
return packI(i.h ^ (i.h >> n), i.l ^ ((i.l >> n) | (i.h << (32 - n))));
|
||||||
}
|
}
|
||||||
|
|
||||||
static I Ixor (I i1, I i2) {
|
static I Ixor (I i1, I i2) {
|
||||||
return pack(i1.h ^ i2.h, i1.l ^ i2.l);
|
return packI(i1.h ^ i2.h, i1.l ^ i2.l);
|
||||||
}
|
}
|
||||||
|
|
||||||
static I Iadd (I i1, I i2) {
|
static I Iadd (I i1, I i2) {
|
||||||
I result = pack(i1.h + i2.h, i1.l + i2.l);
|
I result = packI(i1.h + i2.h, i1.l + i2.l);
|
||||||
if (result.l < i1.l) /* carry? */
|
if (result.l < i1.l) /* carry? */
|
||||||
result.h++;
|
result.h++;
|
||||||
return result;
|
return result;
|
||||||
|
@ -406,7 +406,7 @@ static lua_Unsigned I2UInt (I x) {
|
||||||
|
|
||||||
static I Int2I (lua_Integer n) {
|
static I Int2I (lua_Integer n) {
|
||||||
lua_Unsigned un = n;
|
lua_Unsigned un = n;
|
||||||
return pack((lu_int32)un, (lu_int32)(un >> 31 >> 1));
|
return packI((lu_int32)un, (lu_int32)(un >> 31 >> 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* } */
|
#endif /* } */
|
||||||
|
|
10
ltablib.c
10
ltablib.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: ltablib.c,v 1.94 2018/02/25 12:48:16 roberto Exp roberto $
|
** $Id: ltablib.c,v 1.95 2018/02/27 18:47:32 roberto Exp roberto $
|
||||||
** Library for Table Manipulation
|
** Library for Table Manipulation
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -173,7 +173,7 @@ static int tconcat (lua_State *L) {
|
||||||
** =======================================================
|
** =======================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int pack (lua_State *L) {
|
static int tpack (lua_State *L) {
|
||||||
int i;
|
int i;
|
||||||
int n = lua_gettop(L); /* number of elements to pack */
|
int n = lua_gettop(L); /* number of elements to pack */
|
||||||
lua_createtable(L, n, 1); /* create result table */
|
lua_createtable(L, n, 1); /* create result table */
|
||||||
|
@ -186,7 +186,7 @@ static int pack (lua_State *L) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int unpack (lua_State *L) {
|
static int tunpack (lua_State *L) {
|
||||||
lua_Unsigned n;
|
lua_Unsigned n;
|
||||||
lua_Integer i = luaL_optinteger(L, 2, 1);
|
lua_Integer i = luaL_optinteger(L, 2, 1);
|
||||||
lua_Integer e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1));
|
lua_Integer e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1));
|
||||||
|
@ -408,8 +408,8 @@ static int sort (lua_State *L) {
|
||||||
static const luaL_Reg tab_funcs[] = {
|
static const luaL_Reg tab_funcs[] = {
|
||||||
{"concat", tconcat},
|
{"concat", tconcat},
|
||||||
{"insert", tinsert},
|
{"insert", tinsert},
|
||||||
{"pack", pack},
|
{"pack", tpack},
|
||||||
{"unpack", unpack},
|
{"unpack", tunpack},
|
||||||
{"remove", tremove},
|
{"remove", tremove},
|
||||||
{"move", tmove},
|
{"move", tmove},
|
||||||
{"sort", sort},
|
{"sort", sort},
|
||||||
|
|
Loading…
Reference in New Issue