Merge branch 'master' into v2.1

master
Mike Pall 2018-01-29 12:53:42 +01:00
commit 74c544d68c
3 changed files with 11 additions and 2 deletions

View File

@ -194,7 +194,7 @@ LJLIB_CF(ffi_meta___eq) LJLIB_REC(cdata_arith MM_eq)
LJLIB_CF(ffi_meta___len) LJLIB_REC(cdata_arith MM_len)
{
return ffi_arith(L);
return lj_carith_len(L);
}
LJLIB_CF(ffi_meta___lt) LJLIB_REC(cdata_arith MM_lt)

View File

@ -274,6 +274,15 @@ int lj_carith_op(lua_State *L, MMS mm)
return lj_carith_meta(L, cts, &ca, mm);
}
/* No built-in functionality for length of cdata. */
int lj_carith_len(lua_State *L)
{
CTState *cts = ctype_cts(L);
CDArith ca;
carith_checkarg(L, cts, &ca);
return lj_carith_meta(L, cts, &ca, MM_len);
}
/* -- 64 bit bit operations helpers --------------------------------------- */
#if LJ_64
@ -347,7 +356,6 @@ uint64_t lj_carith_check64(lua_State *L, int narg, CTypeID *id)
}
}
/* -- 64 bit integer arithmetic helpers ----------------------------------- */
#if LJ_32 && LJ_HASJIT

View File

@ -11,6 +11,7 @@
#if LJ_HASFFI
LJ_FUNC int lj_carith_op(lua_State *L, MMS mm);
LJ_FUNC int lj_carith_len(lua_State *L);
#if LJ_32
LJ_FUNC uint64_t lj_carith_shl64(uint64_t x, int32_t sh);