From: Christian Femers Date: Mon, 2 Sep 2019 02:09:23 +0000 (+0200) Subject: Added handy new BitVector manipulation method X-Git-Url: https://mograsim.net/gitweb/?p=Mograsim.git;a=commitdiff_plain;h=63ff99fcb27b6248b62abb01275b9f36dc25544b Added handy new BitVector manipulation method --- diff --git a/net.mograsim.logic.core/src/net/mograsim/logic/core/types/BitVector.java b/net.mograsim.logic.core/src/net/mograsim/logic/core/types/BitVector.java index 4e0fe0b7..4d5f9110 100644 --- a/net.mograsim.logic.core/src/net/mograsim/logic/core/types/BitVector.java +++ b/net.mograsim.logic.core/src/net/mograsim/logic/core/types/BitVector.java @@ -452,6 +452,20 @@ public final class BitVector implements StrictLogicType, Iterable singleBitOperation) + { + Bit[] newBits = bits.clone(); + newBits[msbIndex] = singleBitOperation.apply(newBits[msbIndex]); + return new BitVector(newBits); + } + /** * Iterate over the {@link Bit}s of the BitVector from MSB to LSB (left to right). */