aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2018-01-29 12:53:42 +0100
committerMike Pall <mike>2018-01-29 12:53:42 +0100
commit74c544d68c07bcd416225598cdf15f88e62fd457 (patch)
treee180bc5a5b92a3eba053b9484ffb97c308da949a
parent8071aa4ad65cf09e3b7adda4a7787d8897e5314c (diff)
parentb03a56f28ec360bbcf43091afd0607890a4a33c7 (diff)
downloadluajit-74c544d68c07bcd416225598cdf15f88e62fd457.tar.gz
luajit-74c544d68c07bcd416225598cdf15f88e62fd457.tar.bz2
luajit-74c544d68c07bcd416225598cdf15f88e62fd457.zip
Merge branch 'master' into v2.1
Diffstat (limited to '')
-rw-r--r--src/lib_ffi.c2
-rw-r--r--src/lj_carith.c10
-rw-r--r--src/lj_carith.h1
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
195LJLIB_CF(ffi_meta___len) LJLIB_REC(cdata_arith MM_len) 195LJLIB_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
200LJLIB_CF(ffi_meta___lt) LJLIB_REC(cdata_arith MM_lt) 200LJLIB_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. */
278int 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
13LJ_FUNC int lj_carith_op(lua_State *L, MMS mm); 13LJ_FUNC int lj_carith_op(lua_State *L, MMS mm);
14LJ_FUNC int lj_carith_len(lua_State *L);
14 15
15#if LJ_32 16#if LJ_32
16LJ_FUNC uint64_t lj_carith_shl64(uint64_t x, int32_t sh); 17LJ_FUNC uint64_t lj_carith_shl64(uint64_t x, int32_t sh);