diff options
| -rw-r--r-- | lmathlib.c | 14 | ||||
| -rw-r--r-- | ltablib.c | 10 |
2 files changed, 12 insertions, 12 deletions
| @@ -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 | ||
| 324 | static I pack (lu_int32 h, lu_int32 l) { | 324 | static 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) */ |
| 332 | static I Ixorshl (I i, int n) { | 332 | static 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) */ |
| 337 | static I Ixorshr (I i, int n) { | 337 | static 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 | ||
| 341 | static I Ixor (I i1, I i2) { | 341 | static 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 | ||
| 345 | static I Iadd (I i1, I i2) { | 345 | static 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 | ||
| 407 | static I Int2I (lua_Integer n) { | 407 | static 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 /* } */ |
| @@ -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 | ||
| 176 | static int pack (lua_State *L) { | 176 | static 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 | ||
| 189 | static int unpack (lua_State *L) { | 189 | static 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) { | |||
| 408 | static const luaL_Reg tab_funcs[] = { | 408 | static 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}, |
