diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-12-22 14:19:56 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-12-22 14:19:56 -0200 |
| commit | c505f341d638f8f0adcef4df85bcc8def6c930a3 (patch) | |
| tree | bfa689a7545e47cfd154066cd8d962daa6bc611e /lgc.c | |
| parent | 428325baecb2f514ea3eb6c87405f93872fb8430 (diff) | |
| download | lua-c505f341d638f8f0adcef4df85bcc8def6c930a3.tar.gz lua-c505f341d638f8f0adcef4df85bcc8def6c930a3.tar.bz2 lua-c505f341d638f8f0adcef4df85bcc8def6c930a3.zip | |
small changes in casts
Diffstat (limited to 'lgc.c')
| -rw-r--r-- | lgc.c | 17 |
1 files changed, 8 insertions, 9 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.c,v 2.35 2005/08/04 13:37:38 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.36 2005/08/24 17:06:36 roberto Exp roberto $ |
| 3 | ** Garbage Collector | 3 | ** Garbage Collector |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -29,11 +29,10 @@ | |||
| 29 | #define GCFINALIZECOST 100 | 29 | #define GCFINALIZECOST 100 |
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | #define maskmarks \ | 32 | #define maskmarks cast_byte(~(bitmask(BLACKBIT)|WHITEBITS)) |
| 33 | cast(lu_byte, ~(bitmask(BLACKBIT)|WHITEBITS)) | ||
| 34 | 33 | ||
| 35 | #define makewhite(g,x) \ | 34 | #define makewhite(g,x) \ |
| 36 | ((x)->gch.marked = ((x)->gch.marked & maskmarks) | luaC_white(g)) | 35 | ((x)->gch.marked = cast_byte(((x)->gch.marked & maskmarks) | luaC_white(g))) |
| 37 | 36 | ||
| 38 | #define white2gray(x) reset2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) | 37 | #define white2gray(x) reset2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) |
| 39 | #define black2gray(x) resetbit((x)->gch.marked, BLACKBIT) | 38 | #define black2gray(x) resetbit((x)->gch.marked, BLACKBIT) |
| @@ -169,8 +168,8 @@ static int traversetable (global_State *g, Table *h) { | |||
| 169 | weakvalue = (strchr(svalue(mode), 'v') != NULL); | 168 | weakvalue = (strchr(svalue(mode), 'v') != NULL); |
| 170 | if (weakkey || weakvalue) { /* is really weak? */ | 169 | if (weakkey || weakvalue) { /* is really weak? */ |
| 171 | h->marked &= ~(KEYWEAK | VALUEWEAK); /* clear bits */ | 170 | h->marked &= ~(KEYWEAK | VALUEWEAK); /* clear bits */ |
| 172 | h->marked |= cast(lu_byte, (weakkey << KEYWEAKBIT) | | 171 | h->marked |= cast_byte((weakkey << KEYWEAKBIT) | |
| 173 | (weakvalue << VALUEWEAKBIT)); | 172 | (weakvalue << VALUEWEAKBIT)); |
| 174 | h->gclist = g->weak; /* must be cleared after GC, ... */ | 173 | h->gclist = g->weak; /* must be cleared after GC, ... */ |
| 175 | g->weak = obj2gco(h); /* ... so put in the appropriate list */ | 174 | g->weak = obj2gco(h); /* ... so put in the appropriate list */ |
| 176 | } | 175 | } |
| @@ -240,8 +239,8 @@ static void traverseclosure (global_State *g, Closure *cl) { | |||
| 240 | 239 | ||
| 241 | 240 | ||
| 242 | static void checkstacksizes (lua_State *L, StkId max) { | 241 | static void checkstacksizes (lua_State *L, StkId max) { |
| 243 | int ci_used = cast(int, L->ci - L->base_ci); /* number of `ci' in use */ | 242 | int ci_used = cast_int(L->ci - L->base_ci); /* number of `ci' in use */ |
| 244 | int s_used = cast(int, max - L->stack); /* part of stack in use */ | 243 | int s_used = cast_int(max - L->stack); /* part of stack in use */ |
| 245 | if (L->size_ci > LUAI_MAXCALLS) /* handling overflow? */ | 244 | if (L->size_ci > LUAI_MAXCALLS) /* handling overflow? */ |
| 246 | return; /* do not touch the stacks */ | 245 | return; /* do not touch the stacks */ |
| 247 | if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci) | 246 | if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci) |
| @@ -544,7 +543,7 @@ static void atomic (lua_State *L) { | |||
| 544 | propagateall(g); /* remark, to propagate `preserveness' */ | 543 | propagateall(g); /* remark, to propagate `preserveness' */ |
| 545 | cleartable(g->weak); /* remove collected objects from weak tables */ | 544 | cleartable(g->weak); /* remove collected objects from weak tables */ |
| 546 | /* flip current white */ | 545 | /* flip current white */ |
| 547 | g->currentwhite = cast(lu_byte, otherwhite(g)); | 546 | g->currentwhite = cast_byte(otherwhite(g)); |
| 548 | g->sweepstrgc = 0; | 547 | g->sweepstrgc = 0; |
| 549 | g->sweepgc = &g->rootgc; | 548 | g->sweepgc = &g->rootgc; |
| 550 | g->gcstate = GCSsweepstring; | 549 | g->gcstate = GCSsweepstring; |
