summaryrefslogtreecommitdiff
path: root/src/lj_carith.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_carith.c')
-rw-r--r--src/lj_carith.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lj_carith.c b/src/lj_carith.c
index f1435e1e..a59665d8 100644
--- a/src/lj_carith.c
+++ b/src/lj_carith.c
@@ -41,6 +41,9 @@ static int carith_checkarg(lua_State *L, CTState *cts, CDArith *ca)
41 } 41 }
42 ca->ct[i] = ct; 42 ca->ct[i] = ct;
43 ca->p[i] = p; 43 ca->p[i] = p;
44 } else if (tvisint(o)) {
45 ca->ct[i] = ctype_get(cts, CTID_INT32);
46 ca->p[i] = (uint8_t *)&o->i;
44 } else if (tvisnum(o)) { 47 } else if (tvisnum(o)) {
45 ca->ct[i] = ctype_get(cts, CTID_DOUBLE); 48 ca->ct[i] = ctype_get(cts, CTID_DOUBLE);
46 ca->p[i] = (uint8_t *)&o->n; 49 ca->p[i] = (uint8_t *)&o->n;
@@ -84,7 +87,7 @@ static int carith_ptr(lua_State *L, CTState *cts, CDArith *ca, MMS mm)
84 /* All valid pointer differences on x64 are in (-2^47, +2^47), 87 /* All valid pointer differences on x64 are in (-2^47, +2^47),
85 ** which fits into a double without loss of precision. 88 ** which fits into a double without loss of precision.
86 */ 89 */
87 setnumV(L->top-1, (lua_Number)diff); 90 setintptrV(L->top-1, (int32_t)diff);
88 return 1; 91 return 1;
89 } else if (mm == MM_lt) { /* Pointer comparison (unsigned). */ 92 } else if (mm == MM_lt) { /* Pointer comparison (unsigned). */
90 setboolV(L->top-1, ((uintptr_t)pp < (uintptr_t)pp2)); 93 setboolV(L->top-1, ((uintptr_t)pp < (uintptr_t)pp2));