mirror of https://github.com/rusefi/lua.git
avoid the use of bit 'Bk' ('B' will lose this bit soon)
This commit is contained in:
parent
722bdbe17d
commit
bc1b0733b8
8
lcode.c
8
lcode.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lcode.c,v 2.125 2017/09/26 18:14:45 roberto Exp roberto $
|
||||
** $Id: lcode.c,v 2.126 2017/09/28 16:53:29 roberto Exp roberto $
|
||||
** Code generator for Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -1068,7 +1068,7 @@ static int isKstr (FuncState *fs, expdesc *e) {
|
|||
*/
|
||||
static int isKint (expdesc *e) {
|
||||
return (e->k == VKINT && !hasjumps(e) &&
|
||||
l_castS2U(e->u.ival) <= l_castS2U(MAXARG_C));
|
||||
l_castS2U(e->u.ival) <= l_castS2U(MAXARG_Cr));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1178,8 +1178,8 @@ static void codebinexpval (FuncState *fs, OpCode op,
|
|||
v1 = luaK_exp2anyreg(fs, e1);
|
||||
}
|
||||
else { /* exchange operands to make 2nd one a constant */
|
||||
v2 = cast_int(e1->u.ival);
|
||||
v1 = luaK_exp2anyreg(fs, e2) | BITRK; /* K bit signal the exchange */
|
||||
v2 = cast_int(e1->u.ival) | BITRK; /* K bit signal the exchange */
|
||||
v1 = luaK_exp2anyreg(fs, e2);
|
||||
}
|
||||
op = OP_ADDI;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lopcodes.h,v 1.161 2017/09/26 18:14:45 roberto Exp roberto $
|
||||
** $Id: lopcodes.h,v 1.162 2017/09/28 16:53:29 roberto Exp roberto $
|
||||
** Opcodes for Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -73,6 +73,7 @@ enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */
|
|||
#define MAXARG_A ((1<<SIZE_A)-1)
|
||||
#define MAXARG_B ((1<<SIZE_B)-1)
|
||||
#define MAXARG_C ((1<<SIZE_C)-1)
|
||||
#define MAXARG_Cr ((1<<(SIZE_C - 1))-1)
|
||||
|
||||
|
||||
/* creates a mask with 'n' 1 bits at position 'p' */
|
||||
|
@ -102,10 +103,6 @@ enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */
|
|||
#define GETARG_B(i) check_exp(checkopm(i, iABC), getarg(i, POS_B, SIZE_B))
|
||||
#define SETARG_B(i,v) setarg(i, v, POS_B, SIZE_B)
|
||||
|
||||
#define GETARG_Br(i) \
|
||||
check_exp(checkopm(i, iABC), getarg(i, POS_B, SIZE_B - 1))
|
||||
#define GETARG_Bk(i) getarg(i, (POS_B + SIZE_B - 1), 1)
|
||||
|
||||
#define GETARG_C(i) check_exp(checkopm(i, iABC), getarg(i, POS_C, SIZE_C))
|
||||
#define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C)
|
||||
|
||||
|
@ -142,7 +139,7 @@ enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */
|
|||
*/
|
||||
|
||||
/* this bit 1 means constant (0 means register) */
|
||||
#define BITRK (1 << (SIZE_B - 1))
|
||||
#define BITRK (1 << (SIZE_C - 1))
|
||||
|
||||
/* test whether value is a constant */
|
||||
#define ISK(x) ((x) & BITRK)
|
||||
|
|
8
lvm.c
8
lvm.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lvm.c,v 2.295 2017/09/27 18:59:08 roberto Exp roberto $
|
||||
** $Id: lvm.c,v 2.296 2017/09/28 16:53:29 roberto Exp roberto $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -733,7 +733,7 @@ void luaV_finishOp (lua_State *L) {
|
|||
|
||||
|
||||
#define RA(i) (base+GETARG_A(i))
|
||||
#define RB(i) (base+GETARG_Br(i))
|
||||
#define RB(i) (base+GETARG_B(i))
|
||||
#define vRB(i) s2v(RB(i))
|
||||
#define KB(i) (k+GETARG_B(i))
|
||||
#define RC(i) (base+GETARG_C(i))
|
||||
|
@ -989,7 +989,7 @@ void luaV_execute (lua_State *L) {
|
|||
}
|
||||
vmcase(OP_ADDI) {
|
||||
TValue *rb = vRB(i);
|
||||
int ic = GETARG_C(i);
|
||||
int ic = GETARG_Cr(i);
|
||||
lua_Number nb;
|
||||
if (ttisinteger(rb)) {
|
||||
setivalue(s2v(ra), intop(+, ivalue(rb), ic));
|
||||
|
@ -998,7 +998,7 @@ void luaV_execute (lua_State *L) {
|
|||
setfltvalue(s2v(ra), luai_numadd(L, nb, cast_num(ic)));
|
||||
}
|
||||
else
|
||||
Protect(luaT_trybiniTM(L, rb, ic, GETARG_Bk(i), ra, TM_ADD));
|
||||
Protect(luaT_trybiniTM(L, rb, ic, GETARG_Ck(i), ra, TM_ADD));
|
||||
vmbreak;
|
||||
}
|
||||
vmcase(OP_ADD) {
|
||||
|
|
Loading…
Reference in New Issue