-
- public static Bit[] and(Bit[] a, Bit[] b)
- {
- return binBitOp(a, b, (bA, bB) -> Bit.and(bA, bB));
- }
-
- public static Bit[] or(Bit[] a, Bit[] b)
- {
- return binBitOp(a, b, (bA, bB) -> Bit.or(bA, bB));
- }
-
- public static Bit[] xor(Bit[] a, Bit[] b)
- {
- return binBitOp(a, b, (bA, bB) -> Bit.xor(bA, bB));
- }
-
- private static Bit[] binBitOp(Bit[] a, Bit[] b, BitOp op)
+
+ public static Bit[] and(Bit[] a, Bit[] b)
+ {
+ return binBitOp(a, b, (bA, bB) -> Bit.and(bA, bB));
+ }
+
+ public static Bit[] or(Bit[] a, Bit[] b)
+ {
+ return binBitOp(a, b, (bA, bB) -> Bit.or(bA, bB));
+ }
+
+ public static Bit[] xor(Bit[] a, Bit[] b)
+ {
+ return binBitOp(a, b, (bA, bB) -> Bit.xor(bA, bB));
+ }
+
+ private static Bit[] binBitOp(Bit[] a, Bit[] b, BitOp op)
+ {
+ if (a.length != b.length)
+ throw new IllegalArgumentException("Bit Arrays were not of equal length.");
+ Bit[] out = new Bit[a.length];
+ for (int i = 0; i < a.length; i++)