mirror of
https://github.com/love2d/love.git
synced 2026-08-18 11:44:15 +02:00
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:
@@ -22,7 +22,7 @@ misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
--]]
|
||||
|
||||
local RandomGenerator_mt, ffifuncspointer = ...
|
||||
local RandomGenerator_mt, ffifuncspointer_str = ...
|
||||
local RandomGenerator = RandomGenerator_mt.__index
|
||||
|
||||
local type, tonumber, error = type, tonumber, error
|
||||
@@ -67,7 +67,7 @@ typedef struct FFI_RandomGenerator
|
||||
} FFI_RandomGenerator;
|
||||
]])
|
||||
|
||||
local ffifuncs = ffi.cast("FFI_RandomGenerator *", ffifuncspointer)
|
||||
local ffifuncs = ffi.cast("FFI_RandomGenerator **", ffifuncspointer_str)[0]
|
||||
|
||||
|
||||
-- Overwrite some regular love.math functions with FFI implementations.
|
||||
|
||||
Reference in New Issue
Block a user