diff options
| -rw-r--r-- | lapi.c | 7 |
1 files changed, 4 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 1.221 2002/11/21 14:16:52 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.222 2002/11/21 15:16:04 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -697,7 +697,8 @@ LUA_API int lua_dump (lua_State *L, lua_Chunkwriter writer, void *data) { | |||
| 697 | */ | 697 | */ |
| 698 | 698 | ||
| 699 | /* GC values are expressed in Kbytes: #bytes/2^10 */ | 699 | /* GC values are expressed in Kbytes: #bytes/2^10 */ |
| 700 | #define GCscale(x) (cast(int, (x)>>10)) | 700 | #define GCscalel(x) ((x)>>10) |
| 701 | #define GCscale(x) (cast(int, GCscalel(x))) | ||
| 701 | #define GCunscale(x) (cast(lu_mem, (x)<<10)) | 702 | #define GCunscale(x) (cast(lu_mem, (x)<<10)) |
| 702 | 703 | ||
| 703 | LUA_API int lua_getgcthreshold (lua_State *L) { | 704 | LUA_API int lua_getgcthreshold (lua_State *L) { |
| @@ -718,7 +719,7 @@ LUA_API int lua_getgccount (lua_State *L) { | |||
| 718 | 719 | ||
| 719 | LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold) { | 720 | LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold) { |
| 720 | lua_lock(L); | 721 | lua_lock(L); |
| 721 | if (newthreshold > GCscale(ULONG_MAX)) | 722 | if (cast(lu_mem, newthreshold) > GCscalel(ULONG_MAX)) |
| 722 | G(L)->GCthreshold = ULONG_MAX; | 723 | G(L)->GCthreshold = ULONG_MAX; |
| 723 | else | 724 | else |
| 724 | G(L)->GCthreshold = GCunscale(newthreshold); | 725 | G(L)->GCthreshold = GCunscale(newthreshold); |
