diff options
| author | Mike Pall <mike> | 2018-01-29 12:47:08 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2018-01-29 12:47:08 +0100 |
| commit | b03a56f28ec360bbcf43091afd0607890a4a33c7 (patch) | |
| tree | e8ca6face0a82f440512ad01067c17390fdf5ae8 | |
| parent | c88602f080dcafea6ba222a2f7cc1ea0e41ef3cc (diff) | |
| download | luajit-b03a56f28ec360bbcf43091afd0607890a4a33c7.tar.gz luajit-b03a56f28ec360bbcf43091afd0607890a4a33c7.tar.bz2 luajit-b03a56f28ec360bbcf43091afd0607890a4a33c7.zip | |
FFI: Don't assert on #1LL (5.2 compatibility mode only).
Reported by Denis Golovan.
| -rw-r--r-- | src/lib_ffi.c | 2 | ||||
| -rw-r--r-- | src/lj_carith.c | 9 | ||||
| -rw-r--r-- | src/lj_carith.h | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/src/lib_ffi.c b/src/lib_ffi.c index f2f2ede4..83483d95 100644 --- a/src/lib_ffi.c +++ b/src/lib_ffi.c | |||
| @@ -193,7 +193,7 @@ LJLIB_CF(ffi_meta___eq) LJLIB_REC(cdata_arith MM_eq) | |||
| 193 | 193 | ||
| 194 | LJLIB_CF(ffi_meta___len) LJLIB_REC(cdata_arith MM_len) | 194 | LJLIB_CF(ffi_meta___len) LJLIB_REC(cdata_arith MM_len) |
| 195 | { | 195 | { |
| 196 | return ffi_arith(L); | 196 | return lj_carith_len(L); |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | LJLIB_CF(ffi_meta___lt) LJLIB_REC(cdata_arith MM_lt) | 199 | LJLIB_CF(ffi_meta___lt) LJLIB_REC(cdata_arith MM_lt) |
diff --git a/src/lj_carith.c b/src/lj_carith.c index 6224dee6..c34596ca 100644 --- a/src/lj_carith.c +++ b/src/lj_carith.c | |||
| @@ -272,6 +272,15 @@ int lj_carith_op(lua_State *L, MMS mm) | |||
| 272 | return lj_carith_meta(L, cts, &ca, mm); | 272 | return lj_carith_meta(L, cts, &ca, mm); |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | /* No built-in functionality for length of cdata. */ | ||
| 276 | int lj_carith_len(lua_State *L) | ||
| 277 | { | ||
| 278 | CTState *cts = ctype_cts(L); | ||
| 279 | CDArith ca; | ||
| 280 | carith_checkarg(L, cts, &ca); | ||
| 281 | return lj_carith_meta(L, cts, &ca, MM_len); | ||
| 282 | } | ||
| 283 | |||
| 275 | /* -- 64 bit integer arithmetic helpers ----------------------------------- */ | 284 | /* -- 64 bit integer arithmetic helpers ----------------------------------- */ |
| 276 | 285 | ||
| 277 | #if LJ_32 && LJ_HASJIT | 286 | #if LJ_32 && LJ_HASJIT |
diff --git a/src/lj_carith.h b/src/lj_carith.h index 3c155910..82fc8245 100644 --- a/src/lj_carith.h +++ b/src/lj_carith.h | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #if LJ_HASFFI | 11 | #if LJ_HASFFI |
| 12 | 12 | ||
| 13 | LJ_FUNC int lj_carith_op(lua_State *L, MMS mm); | 13 | LJ_FUNC int lj_carith_op(lua_State *L, MMS mm); |
| 14 | LJ_FUNC int lj_carith_len(lua_State *L); | ||
| 14 | 15 | ||
| 15 | #if LJ_32 && LJ_HASJIT | 16 | #if LJ_32 && LJ_HASJIT |
| 16 | LJ_FUNC int64_t lj_carith_mul64(int64_t x, int64_t k); | 17 | LJ_FUNC int64_t lj_carith_mul64(int64_t x, int64_t k); |
