diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-03-16 11:18:18 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-03-16 11:18:18 -0300 |
commit | 89da4168df5c8f6199504fed6e25fc5326c14fd2 (patch) | |
tree | 0edb4273c895bbd18ec1eab2f97ea03bb5aba173 /lmathlib.c | |
parent | 6b01b6cf6a1631f7ca2ce527a5c355517095c209 (diff) | |
download | lua-89da4168df5c8f6199504fed6e25fc5326c14fd2.tar.gz lua-89da4168df5c8f6199504fed6e25fc5326c14fd2.tar.bz2 lua-89da4168df5c8f6199504fed6e25fc5326c14fd2.zip |
avoid functions named 'pack'
(name too common, may collide when doing 'onelua.c')
Diffstat (limited to 'lmathlib.c')
-rw-r--r-- | lmathlib.c | 14 |
1 files changed, 7 insertions, 7 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 /* } */ |