diff options
-rw-r--r-- | src/lib_ffi.c | 2 | ||||
-rw-r--r-- | src/lj_carith.c | 10 | ||||
-rw-r--r-- | src/lj_carith.h | 1 |
3 files changed, 11 insertions, 2 deletions
diff --git a/src/lib_ffi.c b/src/lib_ffi.c index 136e98e8..199cfc9a 100644 --- a/src/lib_ffi.c +++ b/src/lib_ffi.c | |||
@@ -194,7 +194,7 @@ LJLIB_CF(ffi_meta___eq) LJLIB_REC(cdata_arith MM_eq) | |||
194 | 194 | ||
195 | LJLIB_CF(ffi_meta___len) LJLIB_REC(cdata_arith MM_len) | 195 | LJLIB_CF(ffi_meta___len) LJLIB_REC(cdata_arith MM_len) |
196 | { | 196 | { |
197 | return ffi_arith(L); | 197 | return lj_carith_len(L); |
198 | } | 198 | } |
199 | 199 | ||
200 | LJLIB_CF(ffi_meta___lt) LJLIB_REC(cdata_arith MM_lt) | 200 | LJLIB_CF(ffi_meta___lt) LJLIB_REC(cdata_arith MM_lt) |
diff --git a/src/lj_carith.c b/src/lj_carith.c index 218abd26..1c050eba 100644 --- a/src/lj_carith.c +++ b/src/lj_carith.c | |||
@@ -274,6 +274,15 @@ int lj_carith_op(lua_State *L, MMS mm) | |||
274 | return lj_carith_meta(L, cts, &ca, mm); | 274 | return lj_carith_meta(L, cts, &ca, mm); |
275 | } | 275 | } |
276 | 276 | ||
277 | /* No built-in functionality for length of cdata. */ | ||
278 | int lj_carith_len(lua_State *L) | ||
279 | { | ||
280 | CTState *cts = ctype_cts(L); | ||
281 | CDArith ca; | ||
282 | carith_checkarg(L, cts, &ca); | ||
283 | return lj_carith_meta(L, cts, &ca, MM_len); | ||
284 | } | ||
285 | |||
277 | /* -- 64 bit bit operations helpers --------------------------------------- */ | 286 | /* -- 64 bit bit operations helpers --------------------------------------- */ |
278 | 287 | ||
279 | #if LJ_64 | 288 | #if LJ_64 |
@@ -347,7 +356,6 @@ uint64_t lj_carith_check64(lua_State *L, int narg, CTypeID *id) | |||
347 | } | 356 | } |
348 | } | 357 | } |
349 | 358 | ||
350 | |||
351 | /* -- 64 bit integer arithmetic helpers ----------------------------------- */ | 359 | /* -- 64 bit integer arithmetic helpers ----------------------------------- */ |
352 | 360 | ||
353 | #if LJ_32 && LJ_HASJIT | 361 | #if LJ_32 && LJ_HASJIT |
diff --git a/src/lj_carith.h b/src/lj_carith.h index 67d976bf..3b0a5dd7 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 | 16 | #if LJ_32 |
16 | LJ_FUNC uint64_t lj_carith_shl64(uint64_t x, int32_t sh); | 17 | LJ_FUNC uint64_t lj_carith_shl64(uint64_t x, int32_t sh); |