The MMU for the core of this project currently uses a lua array lookup of bytes, and because of this, it would be super easy to add ffi support (if available - we can always fallback to default lua if it's not available)
local ffi = require "ffi"
if (ffi) then
function loadarray(narr)
return ffi.new("uint8_t[?]", narr
end
else -- no ffi
function loadarray(narr)
local t = {}
for i = 0, narr - 1 do
t[i] = 0
end
end
end
This would have no downsides and is super easy to implement! Was wondering what you thought of these kinds of optimizations? It'd work even if FFI wasn't available and it'd work better if it was.
The MMU for the core of this project currently uses a lua array lookup of bytes, and because of this, it would be super easy to add ffi support (if available - we can always fallback to default lua if it's not available)
This would have no downsides and is super easy to implement! Was wondering what you thought of these kinds of optimizations? It'd work even if FFI wasn't available and it'd work better if it was.