X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=era.mi%2Fsrc%2Fera%2Fmi%2Flogic%2FUtil.java;h=3ca16b7a89eae70b088ed3eb8f9a6cf93e6cbc0d;hb=7f37c7b2431309e49a0ee116d1ee6c173272e926;hp=6bca6d0ef9c542d2789e66fd36392c83a135cbda;hpb=49f569b513c36e8ad421fd5a547bf34bd830652a;p=Mograsim.git diff --git a/era.mi/src/era/mi/logic/Util.java b/era.mi/src/era/mi/logic/Util.java index 6bca6d0e..3ca16b7a 100644 --- a/era.mi/src/era/mi/logic/Util.java +++ b/era.mi/src/era/mi/logic/Util.java @@ -84,6 +84,22 @@ public final class Util } return out; } + + /** + * uses the {@link Bit#combineWith(Bit)} method, does not create a new array, + * the result is stored in the first array. + * + * @author Christian Femers + */ + public static Bit[] combineInto(Bit[] dest, Bit[] addition) + { + if (dest.length != addition.length) + throw new IllegalArgumentException("Bit Arrays were not of equal length."); + for (int i = 0; i < addition.length; i++) { + dest[i] = dest[i].combineWith(addition[i]); + } + return dest; + } interface BitOp {