aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lj_carith.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lj_carith.c b/src/lj_carith.c
index e3287de9d..b1da0e2c3 100644
--- a/src/lj_carith.c
+++ b/src/lj_carith.c
@@ -133,7 +133,7 @@ static int carith_ptr(lua_State *L, CTState *cts, CDArith *ca, MMS mm)
133 return 0; 133 return 0;
134 lj_cconv_ct_ct(cts, ctype_get(cts, CTID_INT_PSZ), ca->ct[1], 134 lj_cconv_ct_ct(cts, ctype_get(cts, CTID_INT_PSZ), ca->ct[1],
135 (uint8_t *)&idx, ca->p[1], 0); 135 (uint8_t *)&idx, ca->p[1], 0);
136 if (mm == MM_sub) idx = -idx; 136 if (mm == MM_sub) idx = (ptrdiff_t)(~(uintptr_t)idx+1u);
137 } else if (mm == MM_add && ctype_isnum(ctp->info) && 137 } else if (mm == MM_add && ctype_isnum(ctp->info) &&
138 (ctype_isptr(ca->ct[1]->info) || ctype_isrefarray(ca->ct[1]->info))) { 138 (ctype_isptr(ca->ct[1]->info) || ctype_isrefarray(ca->ct[1]->info))) {
139 /* Swap pointer and index. */ 139 /* Swap pointer and index. */