aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-03-16 11:18:18 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-03-16 11:18:18 -0300
commit89da4168df5c8f6199504fed6e25fc5326c14fd2 (patch)
tree0edb4273c895bbd18ec1eab2f97ea03bb5aba173
parent6b01b6cf6a1631f7ca2ce527a5c355517095c209 (diff)
downloadlua-89da4168df5c8f6199504fed6e25fc5326c14fd2.tar.gz
lua-89da4168df5c8f6199504fed6e25fc5326c14fd2.tar.bz2
lua-89da4168df5c8f6199504fed6e25fc5326c14fd2.zip
avoid functions named 'pack'
(name too common, may collide when doing 'onelua.c')
-rw-r--r--lmathlib.c14
-rw-r--r--ltablib.c10
2 files changed, 12 insertions, 12 deletions
diff --git a/lmathlib.c b/lmathlib.c
index c5c3c541..aa9ef51a 100644
--- a/lmathlib.c
+++ b/lmathlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmathlib.c,v 1.124 2018/03/11 14:48:09 roberto Exp roberto $ 2** $Id: lmathlib.c,v 1.125 2018/03/12 12:39:03 roberto Exp roberto $
3** Standard mathematical library 3** Standard mathematical library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -321,7 +321,7 @@ typedef struct I {
321** basic operations on 'I' values 321** basic operations on 'I' values
322*/ 322*/
323 323
324static I pack (lu_int32 h, lu_int32 l) { 324static I packI (lu_int32 h, lu_int32 l) {
325 I result; 325 I result;
326 result.h = h; 326 result.h = h;
327 result.l = l; 327 result.l = l;
@@ -330,20 +330,20 @@ static I pack (lu_int32 h, lu_int32 l) {
330 330
331/* i ^ (i << n) */ 331/* i ^ (i << n) */
332static I Ixorshl (I i, int n) { 332static I Ixorshl (I i, int n) {
333 return pack(i.h ^ ((i.h << n) | (i.l >> (32 - n))), i.l ^ (i.l << n)); 333 return packI(i.h ^ ((i.h << n) | (i.l >> (32 - n))), i.l ^ (i.l << n));
334} 334}
335 335
336/* i ^ (i >> n) */ 336/* i ^ (i >> n) */
337static I Ixorshr (I i, int n) { 337static I Ixorshr (I i, int n) {
338 return pack(i.h ^ (i.h >> n), i.l ^ ((i.l >> n) | (i.h << (32 - n)))); 338 return packI(i.h ^ (i.h >> n), i.l ^ ((i.l >> n) | (i.h << (32 - n))));
339} 339}
340 340
341static I Ixor (I i1, I i2) { 341static I Ixor (I i1, I i2) {
342 return pack(i1.h ^ i2.h, i1.l ^ i2.l); 342 return packI(i1.h ^ i2.h, i1.l ^ i2.l);
343} 343}
344 344
345static I Iadd (I i1, I i2) { 345static I Iadd (I i1, I i2) {
346 I result = pack(i1.h + i2.h, i1.l + i2.l); 346 I result = packI(i1.h + i2.h, i1.l + i2.l);
347 if (result.l < i1.l) /* carry? */ 347 if (result.l < i1.l) /* carry? */
348 result.h++; 348 result.h++;
349 return result; 349 return result;
@@ -406,7 +406,7 @@ static lua_Unsigned I2UInt (I x) {
406 406
407static I Int2I (lua_Integer n) { 407static I Int2I (lua_Integer n) {
408 lua_Unsigned un = n; 408 lua_Unsigned un = n;
409 return pack((lu_int32)un, (lu_int32)(un >> 31 >> 1)); 409 return packI((lu_int32)un, (lu_int32)(un >> 31 >> 1));
410} 410}
411 411
412#endif /* } */ 412#endif /* } */
diff --git a/ltablib.c b/ltablib.c
index 22bfae42..5a78c15b 100644
--- a/ltablib.c
+++ b/ltablib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltablib.c,v 1.94 2018/02/25 12:48:16 roberto Exp roberto $ 2** $Id: ltablib.c,v 1.95 2018/02/27 18:47:32 roberto Exp roberto $
3** Library for Table Manipulation 3** Library for Table Manipulation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -173,7 +173,7 @@ static int tconcat (lua_State *L) {
173** ======================================================= 173** =======================================================
174*/ 174*/
175 175
176static int pack (lua_State *L) { 176static int tpack (lua_State *L) {
177 int i; 177 int i;
178 int n = lua_gettop(L); /* number of elements to pack */ 178 int n = lua_gettop(L); /* number of elements to pack */
179 lua_createtable(L, n, 1); /* create result table */ 179 lua_createtable(L, n, 1); /* create result table */
@@ -186,7 +186,7 @@ static int pack (lua_State *L) {
186} 186}
187 187
188 188
189static int unpack (lua_State *L) { 189static int tunpack (lua_State *L) {
190 lua_Unsigned n; 190 lua_Unsigned n;
191 lua_Integer i = luaL_optinteger(L, 2, 1); 191 lua_Integer i = luaL_optinteger(L, 2, 1);
192 lua_Integer e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1)); 192 lua_Integer e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1));
@@ -408,8 +408,8 @@ static int sort (lua_State *L) {
408static const luaL_Reg tab_funcs[] = { 408static const luaL_Reg tab_funcs[] = {
409 {"concat", tconcat}, 409 {"concat", tconcat},
410 {"insert", tinsert}, 410 {"insert", tinsert},
411 {"pack", pack}, 411 {"pack", tpack},
412 {"unpack", unpack}, 412 {"unpack", tunpack},
413 {"remove", tremove}, 413 {"remove", tremove},
414 {"move", tmove}, 414 {"move", tmove},
415 {"sort", sort}, 415 {"sort", sort},