Skip to content

Commit

Permalink
riscv(emit): more sanitization
Browse files Browse the repository at this point in the history
  • Loading branch information
infiWang committed Jun 23, 2023
1 parent 3a065de commit a51de7a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lj_emit_riscv.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,11 @@ static void emit_movrr(ASMState *as, IRIns *ir, Reg dst, Reg src)
static void emit_opk(ASMState *as, RISCVIns riscvi, Reg dest, Reg src,
intptr_t i, RegSet allow)
{
if (((riscvi == RISCVI_ADDI) && checki12(i)) ||
if (((riscvi == RISCVI_ADDI) && checki12((uintptr_t)i)) ||
(((riscvi == RISCVI_XORI) || (riscvi == RISCVI_ORI)) &&
(i >= 0 ? checki12(i << 1) : checki12(i))) ||
(i >= 0 ? checki12((uintptr_t)i << 1) : checki12((uintptr_t)i))) ||
((riscvi == RISCVI_ANDI) &&
(i >= 0 ? checki12(i) : checki12(i << 1)))) {
(i >= 0 ? checki12((uintptr_t)i) : checki12((uintptr_t)i << 1)))) {
emit_dsi(as, riscvi, dest, src, i);
} else {
switch (riscvi) {
Expand Down

0 comments on commit a51de7a

Please sign in to comment.