diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-12-12 14:08:55 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-12-12 14:08:55 -0300 |
commit | ff106c028ca944ee5e95b005628e2669b87bcaf2 (patch) | |
tree | 656a0733e61d6a728de4e4ea1ecaea18f171c3eb | |
parent | d738c8d18bcc5651109b3a46103d6aa983772e68 (diff) | |
parent | fa2f294dd1269115bf9cf534dd38553e2f606801 (diff) | |
download | lua-ff106c028ca944ee5e95b005628e2669b87bcaf2.tar.gz lua-ff106c028ca944ee5e95b005628e2669b87bcaf2.tar.bz2 lua-ff106c028ca944ee5e95b005628e2669b87bcaf2.zip |
Merge branch 'master' into nextversion
-rw-r--r-- | lgc.c | 8 | ||||
-rw-r--r-- | lmathlib.c | 10 |
2 files changed, 11 insertions, 7 deletions
@@ -1614,12 +1614,16 @@ static void incstep (lua_State *L, global_State *g) { | |||
1614 | } | 1614 | } |
1615 | 1615 | ||
1616 | /* | 1616 | /* |
1617 | ** performs a basic GC step if collector is running | 1617 | ** Performs a basic GC step if collector is running. (If collector is |
1618 | ** not running, set a reasonable debt to avoid it being called at | ||
1619 | ** every single check.) | ||
1618 | */ | 1620 | */ |
1619 | void luaC_step (lua_State *L) { | 1621 | void luaC_step (lua_State *L) { |
1620 | global_State *g = G(L); | 1622 | global_State *g = G(L); |
1621 | lua_assert(!g->gcemergency); | 1623 | lua_assert(!g->gcemergency); |
1622 | if (gcrunning(g)) { /* running? */ | 1624 | if (!gcrunning(g)) /* not running? */ |
1625 | luaE_setdebt(g, -2000); | ||
1626 | else { | ||
1623 | switch (g->gckind) { | 1627 | switch (g->gckind) { |
1624 | case KGC_INC: | 1628 | case KGC_INC: |
1625 | incstep(L, g); | 1629 | incstep(L, g); |
@@ -267,7 +267,7 @@ static int math_type (lua_State *L) { | |||
267 | 267 | ||
268 | /* try to find an integer type with at least 64 bits */ | 268 | /* try to find an integer type with at least 64 bits */ |
269 | 269 | ||
270 | #if (ULONG_MAX >> 31 >> 31) >= 3 | 270 | #if ((ULONG_MAX >> 31) >> 31) >= 3 |
271 | 271 | ||
272 | /* 'long' has at least 64 bits */ | 272 | /* 'long' has at least 64 bits */ |
273 | #define Rand64 unsigned long | 273 | #define Rand64 unsigned long |
@@ -277,9 +277,9 @@ static int math_type (lua_State *L) { | |||
277 | /* there is a 'long long' type (which must have at least 64 bits) */ | 277 | /* there is a 'long long' type (which must have at least 64 bits) */ |
278 | #define Rand64 unsigned long long | 278 | #define Rand64 unsigned long long |
279 | 279 | ||
280 | #elif (LUA_MAXUNSIGNED >> 31 >> 31) >= 3 | 280 | #elif ((LUA_MAXUNSIGNED >> 31) >> 31) >= 3 |
281 | 281 | ||
282 | /* 'lua_Integer' has at least 64 bits */ | 282 | /* 'lua_Unsigned' has at least 64 bits */ |
283 | #define Rand64 lua_Unsigned | 283 | #define Rand64 lua_Unsigned |
284 | 284 | ||
285 | #endif | 285 | #endif |
@@ -500,12 +500,12 @@ static lua_Number I2d (Rand64 x) { | |||
500 | 500 | ||
501 | /* convert a 'Rand64' to a 'lua_Unsigned' */ | 501 | /* convert a 'Rand64' to a 'lua_Unsigned' */ |
502 | static lua_Unsigned I2UInt (Rand64 x) { | 502 | static lua_Unsigned I2UInt (Rand64 x) { |
503 | return ((lua_Unsigned)trim32(x.h) << 31 << 1) | (lua_Unsigned)trim32(x.l); | 503 | return (((lua_Unsigned)trim32(x.h) << 31) << 1) | (lua_Unsigned)trim32(x.l); |
504 | } | 504 | } |
505 | 505 | ||
506 | /* convert a 'lua_Unsigned' to a 'Rand64' */ | 506 | /* convert a 'lua_Unsigned' to a 'Rand64' */ |
507 | static Rand64 Int2I (lua_Unsigned n) { | 507 | static Rand64 Int2I (lua_Unsigned n) { |
508 | return packI((lu_int32)(n >> 31 >> 1), (lu_int32)n); | 508 | return packI((lu_int32)((n >> 31) >> 1), (lu_int32)n); |
509 | } | 509 | } |
510 | 510 | ||
511 | #endif /* } */ | 511 | #endif /* } */ |