static void incstep (lua_State *L, global_State *g) {
int stepmul = (getgcparam(g->gcstepmul) | 1); /* avoid division by 0 */
l_mem debt = (g->GCdebt / LUAI_GCMUL) + 1; /*miss this code in lua5.4.3*/
debt = (debt / WORK2MEM) * stepmul;
l_mem stepsize = (g->gcstepsize <= log2maxs(l_mem))
? ((cast(l_mem, 1) << g->gcstepsize) / WORK2MEM) * stepmul
: MAX_LMEM; /* overflow; keep maximum value */
int oldgcstate = g->gcstate;
do { /* repeat until pause or enough "credit" (negative debt) */
lu_mem work = singlestep(L); /* perform one single step */
debt -= work * WORK2MEM;
singlestep(L);
} while (debt > -GCSTEPSIZE && g->gcstate != GCSpause);
if (g->gcstate == GCSpause && oldgcstate != GCSenterinc)
setpause(g); /* pause until next cycle */
else {
debt = (debt / stepmul) * WORK2MEM; /* convert 'work units' to bytes */
luaE_setdebt(g, debt);
}
}