From 1f53849df9e0f53137aa1022c60ea8ef8d6c8bb2 Mon Sep 17 00:00:00 2001 From: DS-Minetest Date: Tue, 3 Oct 2017 14:19:22 +0200 Subject: [PATCH] do some arithmetic instead of if --- mesecons_fpga/init.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mesecons_fpga/init.lua b/mesecons_fpga/init.lua index 7781507..fdcdbce 100644 --- a/mesecons_fpga/init.lua +++ b/mesecons_fpga/init.lua @@ -143,11 +143,7 @@ plg.register_nodes({ if o and o.type == "io" then local num = abcd2[o.port] num = num + dir - if num > 4 then - num = 1 - elseif num < 1 then - num = 4 - end + num = (2 ^ num % 2) * 4 + num + math.floor(num / 5) instr[i][op].port = abcd1[num] end end