Add Data:getFFIPointer. Similar to Data:getPointer but returns a cdata pointer directly (or nil if the FFI isn't available).

It should be preferred instead of Data:getPointer because the latter uses lightuserdata which can't store more all possible memory addresses on some new arm64 architectures, when LuaJIT is used.
This commit is contained in:
Alex Szpakowski
2019-07-20 10:47:58 -03:00
parent d700800888
commit cb4b45dcf1
17 changed files with 170 additions and 64 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
--]]
local ImageData_mt, ffifuncspointer = ...
local ImageData_mt, ffifuncspointer_str = ...
local ImageData = ImageData_mt.__index
local tonumber, assert, error = tonumber, assert, error
@@ -103,7 +103,7 @@ struct ImageData_Pixel_RG32F { float r, g; };
struct ImageData_Pixel_RGBA32F { float r, g, b, a; };
]])
local ffifuncs = ffi.cast("FFI_ImageData *", ffifuncspointer)
local ffifuncs = ffi.cast("FFI_ImageData **", ffifuncspointer_str)[0]
local conversions = {
r8 = {