From: Fabian Stemmler Date: Mon, 20 May 2019 13:05:26 +0000 (+0200) Subject: Cleanup X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=953984f215af2b455477d42db469b119c016439b;p=Mograsim.git Cleanup --- diff --git a/era.mi/src/era/mi/logic/wires/Wire.java b/era.mi/src/era/mi/logic/wires/Wire.java index d85fc206..4c245712 100644 --- a/era.mi/src/era/mi/logic/wires/Wire.java +++ b/era.mi/src/era/mi/logic/wires/Wire.java @@ -60,12 +60,7 @@ public class Wire Bit[] bits = input.getInputValues(); for (int i = 0; i < length; i++) { - if (Bit.Z.equals(bits[i]) || newValues[i].equals(bits[i])) - continue; - else if (Bit.Z.equals(newValues[i])) - newValues[i] = bits[i]; - else - newValues[i] = Bit.X; + newValues[i] = newValues[i].combineWith(bits[i]); } } @@ -247,12 +242,10 @@ public class Wire */ public void feedSignals(Bit... newValues) { - if (newValues.length == length) - { - feedSignals(0, newValues); - } else + if (newValues.length != length) throw new IllegalArgumentException( String.format("Attempted to input %d bits instead of %d bits.", newValues.length, length)); + feedSignals(0, newValues); } /**