fix gate struct sizing

This commit is contained in:
Redo 2022-11-04 13:21:41 -06:00
parent 7e19e20caf
commit 5438de0adf

View File

@ -25,7 +25,7 @@ function Gate.new(objref, definition)
objref = objref,
definition = definition,
}
local cdata = ffi.new("char["..(ffi.sizeof("struct Gate") + ffi.sizeof("struct OutPort")*(#gate.ports+1)).."]")
local cdata = ffi.new("char["..(ffi.sizeof("struct Gate") + ffi.sizeof("struct OutPort")*(#definition.ports+1)).."]")
gate.c = ffi.cast("struct Gate*", cdata)
gate.c.in_queue = 0
return gate