From 953984f215af2b455477d42db469b119c016439b Mon Sep 17 00:00:00 2001 From: Fabian Stemmler Date: Mon, 20 May 2019 15:05:26 +0200 Subject: [PATCH] Cleanup --- era.mi/src/era/mi/logic/wires/Wire.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) 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); } /** -- 2.17.1