aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-05-08 15:18:57 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-05-08 15:18:57 -0300
commit7ade1557627cf3f09c23c892ee227b7386f28414 (patch)
treeef534e61b85351c4edc5debb5d6f6a580e8fc5da /lcode.c
parentd827e96f33056bcc0daca0c04b3273604f9d5986 (diff)
downloadlua-7ade1557627cf3f09c23c892ee227b7386f28414.tar.gz
lua-7ade1557627cf3f09c23c892ee227b7386f28414.tar.bz2
lua-7ade1557627cf3f09c23c892ee227b7386f28414.zip
Janitorial work on casts
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lcode.c b/lcode.c
index 8f658500..119d91ab 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1317,22 +1317,22 @@ void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) {
1317 lu_byte temp = cast_byte(t->u.info); /* upvalue index */ 1317 lu_byte temp = cast_byte(t->u.info); /* upvalue index */
1318 t->u.ind.t = temp; /* (can't do a direct assignment; values overlap) */ 1318 t->u.ind.t = temp; /* (can't do a direct assignment; values overlap) */
1319 lua_assert(isKstr(fs, k)); 1319 lua_assert(isKstr(fs, k));
1320 t->u.ind.idx = cast(short, k->u.info); /* literal short string */ 1320 t->u.ind.idx = cast_short(k->u.info); /* literal short string */
1321 t->k = VINDEXUP; 1321 t->k = VINDEXUP;
1322 } 1322 }
1323 else { 1323 else {
1324 /* register index of the table */ 1324 /* register index of the table */
1325 t->u.ind.t = cast_byte((t->k == VLOCAL) ? t->u.var.ridx: t->u.info); 1325 t->u.ind.t = cast_byte((t->k == VLOCAL) ? t->u.var.ridx: t->u.info);
1326 if (isKstr(fs, k)) { 1326 if (isKstr(fs, k)) {
1327 t->u.ind.idx = cast(short, k->u.info); /* literal short string */ 1327 t->u.ind.idx = cast_short(k->u.info); /* literal short string */
1328 t->k = VINDEXSTR; 1328 t->k = VINDEXSTR;
1329 } 1329 }
1330 else if (isCint(k)) { /* int. constant in proper range? */ 1330 else if (isCint(k)) { /* int. constant in proper range? */
1331 t->u.ind.idx = cast(short, k->u.ival); 1331 t->u.ind.idx = cast_short(k->u.ival);
1332 t->k = VINDEXI; 1332 t->k = VINDEXI;
1333 } 1333 }
1334 else { 1334 else {
1335 t->u.ind.idx = cast(short, luaK_exp2anyreg(fs, k)); /* register */ 1335 t->u.ind.idx = cast_short(luaK_exp2anyreg(fs, k)); /* register */
1336 t->k = VINDEXED; 1336 t->k = VINDEXED;
1337 } 1337 }
1338 } 1338 }