Blame SOURCES/0031-FFI-Don-t-assert-on-1LL-5.2-compatibility-mode-only.patch

006bc1
commit 74c544d68c07bcd416225598cdf15f88e62fd457
006bc1
Merge: 8071aa4 b03a56f
006bc1
Author: Mike Pall <mike>
006bc1
Date:   Mon Jan 29 12:53:42 2018 +0100
006bc1
006bc1
    Merge branch 'master' into v2.1
006bc1
006bc1
From b03a56f28ec360bbcf43091afd0607890a4a33c7 Mon Sep 17 00:00:00 2001
006bc1
From: Mike Pall <mike>
006bc1
Date: Mon, 29 Jan 2018 12:47:08 +0100
006bc1
Subject: [PATCH 31/72] FFI: Don't assert on #1LL (5.2 compatibility mode
006bc1
 only).
006bc1
006bc1
Reported by Denis Golovan.
006bc1
---
006bc1
 src/lib_ffi.c   | 2 +-
006bc1
 src/lj_carith.c | 9 +++++++++
006bc1
 src/lj_carith.h | 1 +
006bc1
 3 files changed, 11 insertions(+), 1 deletion(-)
006bc1
006bc1
diff --git a/src/lib_ffi.c b/src/lib_ffi.c
006bc1
index f2f2ede..83483d9 100644
006bc1
--- a/src/lib_ffi.c
006bc1
+++ b/src/lib_ffi.c
006bc1
@@ -193,7 +193,7 @@ LJLIB_CF(ffi_meta___eq)		LJLIB_REC(cdata_arith MM_eq)
006bc1
 
006bc1
 LJLIB_CF(ffi_meta___len)	LJLIB_REC(cdata_arith MM_len)
006bc1
 {
006bc1
-  return ffi_arith(L);
006bc1
+  return lj_carith_len(L);
006bc1
 }
006bc1
 
006bc1
 LJLIB_CF(ffi_meta___lt)		LJLIB_REC(cdata_arith MM_lt)
006bc1
diff --git a/src/lj_carith.c b/src/lj_carith.c
006bc1
index 6224dee..c34596c 100644
006bc1
--- a/src/lj_carith.c
006bc1
+++ b/src/lj_carith.c
006bc1
@@ -272,6 +272,15 @@ int lj_carith_op(lua_State *L, MMS mm)
006bc1
   return lj_carith_meta(L, cts, &ca, mm);
006bc1
 }
006bc1
 
006bc1
+/* No built-in functionality for length of cdata. */
006bc1
+int lj_carith_len(lua_State *L)
006bc1
+{
006bc1
+  CTState *cts = ctype_cts(L);
006bc1
+  CDArith ca;
006bc1
+  carith_checkarg(L, cts, &ca);
006bc1
+  return lj_carith_meta(L, cts, &ca, MM_len);
006bc1
+}
006bc1
+
006bc1
 /* -- 64 bit bit operations helpers --------------------------------------- */
006bc1
 
006bc1
 #if LJ_64
006bc1
diff --git a/src/lj_carith.h b/src/lj_carith.h
006bc1
index 3c15591..82fc824 100644
006bc1
--- a/src/lj_carith.h
006bc1
+++ b/src/lj_carith.h
006bc1
@@ -11,6 +11,7 @@
006bc1
 #if LJ_HASFFI
006bc1
 
006bc1
 LJ_FUNC int lj_carith_op(lua_State *L, MMS mm);
006bc1
+LJ_FUNC int lj_carith_len(lua_State *L);
006bc1
 
006bc1
 #if LJ_32
006bc1
 LJ_FUNC uint64_t lj_carith_shl64(uint64_t x, int32_t sh);
006bc1
006bc1
-- 
006bc1
2.20.1
006bc1