more precision for gc count

This commit is contained in:
Roberto Ierusalimschy
2005-10-20 09:35:50 -02:00
parent 515d556832
commit 9f4211310f
3 changed files with 28 additions and 9 deletions

6
lapi.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 2.49 2005/09/14 17:44:48 roberto Exp roberto $
** $Id: lapi.c,v 2.50 2005/09/20 17:55:10 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -913,6 +913,10 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
res = cast(int, g->totalbytes >> 10);
break;
}
case LUA_GCCOUNTB: {
res = cast(int, g->totalbytes & 0x3ff);
break;
}
case LUA_GCSTEP: {
lu_mem a = (cast(lu_mem, data) << 10);
if (a <= g->totalbytes)