make states numbers instead of booleans

This commit is contained in:
Redo0
2021-05-29 13:14:50 -05:00
parent b08c3cd0c4
commit 16c1a9f75f
309 changed files with 2819 additions and 2819 deletions

View File

@@ -20,12 +20,12 @@ datablock fxDTSBrickData(LogicGate_8bitMultiplier_Data)
"return function(gate) local a, b = 0, 0 " @
" local sum = 0 " @
" for i = 1, 8 do " @
" a = a + bool_to_int[Gate.getportstate(gate, i )] * 2^(i-1) " @
" b = b + bool_to_int[Gate.getportstate(gate, i+8)] * 2^(i-1) " @
" a = a + Gate.getportstate(gate, i ) * 2^(i-1) " @
" b = b + Gate.getportstate(gate, i+8) * 2^(i-1) " @
" end " @
" local sum = a * b " @
" for i = 1, 16 do " @
" Gate.setportstate(gate, i+16, bit.band(sum, 2^(i-1)) > 0) " @
" Gate.setportstate(gate, i+16, (bit.band(sum, 2^(i-1)) > 0) and 1 or 0) " @
" end " @
"end"
;