make states numbers instead of booleans
This commit is contained in:
@@ -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"
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user