aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/lcode.c b/lcode.c
index eade2806..caac6ba3 100644
--- a/lcode.c
+++ b/lcode.c
@@ -415,7 +415,7 @@ int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) {
415/* 415/*
416** Format and emit an 'iAsBx' instruction. 416** Format and emit an 'iAsBx' instruction.
417*/ 417*/
418int luaK_codeAsBx (FuncState *fs, OpCode o, int a, int bc) { 418static int codeAsBx (FuncState *fs, OpCode o, int a, int bc) {
419 unsigned int b = bc + OFFSET_sBx; 419 unsigned int b = bc + OFFSET_sBx;
420 lua_assert(getOpMode(o) == iAsBx); 420 lua_assert(getOpMode(o) == iAsBx);
421 lua_assert(a <= MAXARG_A && b <= MAXARG_Bx); 421 lua_assert(a <= MAXARG_A && b <= MAXARG_Bx);
@@ -671,7 +671,7 @@ static int fitsBx (lua_Integer i) {
671 671
672void luaK_int (FuncState *fs, int reg, lua_Integer i) { 672void luaK_int (FuncState *fs, int reg, lua_Integer i) {
673 if (fitsBx(i)) 673 if (fitsBx(i))
674 luaK_codeAsBx(fs, OP_LOADI, reg, cast_int(i)); 674 codeAsBx(fs, OP_LOADI, reg, cast_int(i));
675 else 675 else
676 luaK_codek(fs, reg, luaK_intK(fs, i)); 676 luaK_codek(fs, reg, luaK_intK(fs, i));
677} 677}
@@ -680,7 +680,7 @@ void luaK_int (FuncState *fs, int reg, lua_Integer i) {
680static void luaK_float (FuncState *fs, int reg, lua_Number f) { 680static void luaK_float (FuncState *fs, int reg, lua_Number f) {
681 lua_Integer fi; 681 lua_Integer fi;
682 if (luaV_flttointeger(f, &fi, F2Ieq) && fitsBx(fi)) 682 if (luaV_flttointeger(f, &fi, F2Ieq) && fitsBx(fi))
683 luaK_codeAsBx(fs, OP_LOADF, reg, cast_int(fi)); 683 codeAsBx(fs, OP_LOADF, reg, cast_int(fi));
684 else 684 else
685 luaK_codek(fs, reg, luaK_numberK(fs, f)); 685 luaK_codek(fs, reg, luaK_numberK(fs, f));
686} 686}
@@ -1025,7 +1025,7 @@ static int luaK_exp2K (FuncState *fs, expdesc *e) {
1025** in the range of R/K indices). 1025** in the range of R/K indices).
1026** Returns 1 iff expression is K. 1026** Returns 1 iff expression is K.
1027*/ 1027*/
1028int luaK_exp2RK (FuncState *fs, expdesc *e) { 1028static int exp2RK (FuncState *fs, expdesc *e) {
1029 if (luaK_exp2K(fs, e)) 1029 if (luaK_exp2K(fs, e))
1030 return 1; 1030 return 1;
1031 else { /* not a constant in the right range: put it in a register */ 1031 else { /* not a constant in the right range: put it in a register */
@@ -1037,7 +1037,7 @@ int luaK_exp2RK (FuncState *fs, expdesc *e) {
1037 1037
1038static void codeABRK (FuncState *fs, OpCode o, int a, int b, 1038static void codeABRK (FuncState *fs, OpCode o, int a, int b,
1039 expdesc *ec) { 1039 expdesc *ec) {
1040 int k = luaK_exp2RK(fs, ec); 1040 int k = exp2RK(fs, ec);
1041 luaK_codeABCk(fs, o, a, b, ec->u.info, k); 1041 luaK_codeABCk(fs, o, a, b, ec->u.info, k);
1042} 1042}
1043 1043
@@ -1225,7 +1225,7 @@ static int isKstr (FuncState *fs, expdesc *e) {
1225/* 1225/*
1226** Check whether expression 'e' is a literal integer. 1226** Check whether expression 'e' is a literal integer.
1227*/ 1227*/
1228int luaK_isKint (expdesc *e) { 1228static int isKint (expdesc *e) {
1229 return (e->k == VKINT && !hasjumps(e)); 1229 return (e->k == VKINT && !hasjumps(e));
1230} 1230}
1231 1231
@@ -1235,7 +1235,7 @@ int luaK_isKint (expdesc *e) {
1235** proper range to fit in register C 1235** proper range to fit in register C
1236*/ 1236*/
1237static int isCint (expdesc *e) { 1237static int isCint (expdesc *e) {
1238 return luaK_isKint(e) && (l_castS2U(e->u.ival) <= l_castS2U(MAXARG_C)); 1238 return isKint(e) && (l_castS2U(e->u.ival) <= l_castS2U(MAXARG_C));
1239} 1239}
1240 1240
1241 1241
@@ -1244,7 +1244,7 @@ static int isCint (expdesc *e) {
1244** proper range to fit in register sC 1244** proper range to fit in register sC
1245*/ 1245*/
1246static int isSCint (expdesc *e) { 1246static int isSCint (expdesc *e) {
1247 return luaK_isKint(e) && fitsC(e->u.ival); 1247 return isKint(e) && fitsC(e->u.ival);
1248} 1248}
1249 1249
1250 1250
@@ -1460,7 +1460,7 @@ static void codebinK (FuncState *fs, BinOpr opr,
1460*/ 1460*/
1461static int finishbinexpneg (FuncState *fs, expdesc *e1, expdesc *e2, 1461static int finishbinexpneg (FuncState *fs, expdesc *e1, expdesc *e2,
1462 OpCode op, int line, TMS event) { 1462 OpCode op, int line, TMS event) {
1463 if (!luaK_isKint(e2)) 1463 if (!isKint(e2))
1464 return 0; /* not an integer constant */ 1464 return 0; /* not an integer constant */
1465 else { 1465 else {
1466 lua_Integer i2 = e2->u.ival; 1466 lua_Integer i2 = e2->u.ival;
@@ -1593,7 +1593,7 @@ static void codeeq (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) {
1593 op = OP_EQI; 1593 op = OP_EQI;
1594 r2 = im; /* immediate operand */ 1594 r2 = im; /* immediate operand */
1595 } 1595 }
1596 else if (luaK_exp2RK(fs, e2)) { /* 2nd expression is constant? */ 1596 else if (exp2RK(fs, e2)) { /* 2nd expression is constant? */
1597 op = OP_EQK; 1597 op = OP_EQK;
1598 r2 = e2->u.info; /* constant index */ 1598 r2 = e2->u.info; /* constant index */
1599 } 1599 }
@@ -1659,7 +1659,7 @@ void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) {
1659 } 1659 }
1660 case OPR_EQ: case OPR_NE: { 1660 case OPR_EQ: case OPR_NE: {
1661 if (!tonumeral(v, NULL)) 1661 if (!tonumeral(v, NULL))
1662 luaK_exp2RK(fs, v); 1662 exp2RK(fs, v);
1663 /* else keep numeral, which may be an immediate operand */ 1663 /* else keep numeral, which may be an immediate operand */
1664 break; 1664 break;
1665 } 1665 }