aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2026-03-27 19:47:27 +0100
committerMike Pall <mike>2026-03-27 19:47:27 +0100
commitb58b07189521e82c7a8e8bc43fc3c271f89832fd (patch)
tree465bc41bdfb3f46a51466ad42b245858991578c8
parent89f268b3f745dba80da6350d3cbbb0964f3fdbee (diff)
downloadluajit-b58b07189521e82c7a8e8bc43fc3c271f89832fd.tar.gz
luajit-b58b07189521e82c7a8e8bc43fc3c271f89832fd.tar.bz2
luajit-b58b07189521e82c7a8e8bc43fc3c271f89832fd.zip
FFI: Fix pointer difference operation on 64 bit platforms.
Thanks to cuiweixie. #1449
-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 418400cf..e3287de9 100644
--- a/src/lj_carith.c
+++ b/src/lj_carith.c
@@ -118,7 +118,7 @@ static int carith_ptr(lua_State *L, CTState *cts, CDArith *ca, MMS mm)
118 /* All valid pointer differences on x64 are in (-2^47, +2^47), 118 /* All valid pointer differences on x64 are in (-2^47, +2^47),
119 ** which fits into a double without loss of precision. 119 ** which fits into a double without loss of precision.
120 */ 120 */
121 setintptrV(L->top-1, (int32_t)diff); 121 setintptrV(L->top-1, diff);
122 return 1; 122 return 1;
123 } else if (mm == MM_lt) { /* Pointer comparison (unsigned). */ 123 } else if (mm == MM_lt) { /* Pointer comparison (unsigned). */
124 setboolV(L->top-1, ((uintptr_t)pp < (uintptr_t)pp2)); 124 setboolV(L->top-1, ((uintptr_t)pp < (uintptr_t)pp2));