Skip to content

Commit

Permalink
Fix IR_BUFPUT assembly.
Browse files Browse the repository at this point in the history
Thanks to Peter Cawley.
  • Loading branch information
Mike Pall committed Jan 14, 2018
1 parent ea7071d commit 58d0dde
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lj_asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1119,15 +1119,15 @@ static void asm_bufput(ASMState *as, IRIns *ir)
const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_buf_putstr];
IRRef args[3];
IRIns *irs;
int kchar = -1;
int kchar = -129;
args[0] = ir->op1; /* SBuf * */
args[1] = ir->op2; /* GCstr * */
irs = IR(ir->op2);
lua_assert(irt_isstr(irs->t));
if (irs->o == IR_KGC) {
GCstr *s = ir_kstr(irs);
if (s->len == 1) { /* Optimize put of single-char string constant. */
kchar = strdata(s)[0];
kchar = (int8_t)strdata(s)[0]; /* Signed! */
args[1] = ASMREF_TMP1; /* int, truncated to char */
ci = &lj_ir_callinfo[IRCALL_lj_buf_putchar];
}
Expand All @@ -1154,7 +1154,7 @@ static void asm_bufput(ASMState *as, IRIns *ir)
asm_gencall(as, ci, args);
if (args[1] == ASMREF_TMP1) {
Reg tmp = ra_releasetmp(as, ASMREF_TMP1);
if (kchar == -1)
if (kchar == -129)
asm_tvptr(as, tmp, irs->op1);
else
ra_allockreg(as, kchar, tmp);
Expand Down

0 comments on commit 58d0dde

Please sign in to comment.