use c structs around queues
This commit is contained in:
parent
9744345219
commit
e8208b2f34
@ -212,8 +212,7 @@ function Group.mergeinto(group, group2)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Logic Critical
|
-- Logic Critical
|
||||||
function Group.update(net, tick)
|
function Group.update_c(cnet, tick)
|
||||||
local cnet = net.c
|
|
||||||
local state = cnet.state_num[0]>0 and 1 or 0
|
local state = cnet.state_num[0]>0 and 1 or 0
|
||||||
if state ~= cnet.state[0] then
|
if state ~= cnet.state[0] then
|
||||||
cnet.state[0] = state
|
cnet.state[0] = state
|
||||||
@ -223,8 +222,7 @@ function Group.update(net, tick)
|
|||||||
for i = 0, len do
|
for i = 0, len do
|
||||||
local cgate = cnet.gates_update_c[i]
|
local cgate = cnet.gates_update_c[i]
|
||||||
if cgate.in_queue[0]==0 then
|
if cgate.in_queue[0]==0 then
|
||||||
local gate = Simulation.gate_from_cgate(GSim, cgate)
|
Simulation.queuegate_c(GSim, cgate)
|
||||||
Simulation.queuegate(GSim, gate)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -252,6 +252,11 @@ function Simulation.queuegate(sim, gate)
|
|||||||
gate.in_queue[0] = 1
|
gate.in_queue[0] = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Simulation.queuegate_c(sim, cgate)
|
||||||
|
local gate = Simulation.gate_from_cgate(cgate)
|
||||||
|
Simulation.queuegate(sim, gate)
|
||||||
|
end
|
||||||
|
|
||||||
function Simulation.queuegate_safe(sim, gate)
|
function Simulation.queuegate_safe(sim, gate)
|
||||||
if gate.in_queue[0]==0 then
|
if gate.in_queue[0]==0 then
|
||||||
Simulation.queuegate(sim, gate)
|
Simulation.queuegate(sim, gate)
|
||||||
@ -326,8 +331,9 @@ end
|
|||||||
function Simulation.ticklogic(sim)
|
function Simulation.ticklogic(sim)
|
||||||
for i = 1, sim.num_groupqueue do
|
for i = 1, sim.num_groupqueue do
|
||||||
local net = sim.groupqueue[i]
|
local net = sim.groupqueue[i]
|
||||||
Group.update(net, sim.current_tick)
|
local cnet = net.c
|
||||||
net.in_queue[0] = 0
|
Group.update_c(cnet, sim.current_tick)
|
||||||
|
cnet.in_queue[0] = 0
|
||||||
sim.groupqueue[i] = nil
|
sim.groupqueue[i] = nil
|
||||||
end
|
end
|
||||||
sim.num_groupqueue = 0
|
sim.num_groupqueue = 0
|
||||||
@ -343,8 +349,10 @@ function Simulation.ticklogic(sim)
|
|||||||
|
|
||||||
for i = 1, sim.num_gatequeue do
|
for i = 1, sim.num_gatequeue do
|
||||||
local gate = sim.gatequeue[i]
|
local gate = sim.gatequeue[i]
|
||||||
|
local cgate = gate.c
|
||||||
|
gate = Simulation.gate_from_cgate(sim, cgate)
|
||||||
gate.logic(gate)
|
gate.logic(gate)
|
||||||
gate.in_queue[0] = 0
|
cgate.in_queue[0] = 0
|
||||||
sim.gatequeue[i] = nil
|
sim.gatequeue[i] = nil
|
||||||
end
|
end
|
||||||
sim.num_gatequeue = 0
|
sim.num_gatequeue = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user