Fixes a bug that prevented the analysis of the BitExtender.

This commit is contained in:
hneemann 2018-01-15 12:37:32 +01:00
parent 0c1714c38c
commit 249df37bd9

View File

@ -48,12 +48,15 @@ public class BitExtender implements Element {
final long signMask = Bits.signedFlagMask(inBits);
final long extendMask = ~Bits.mask(inBits);
in.addObserver(() -> {
long inValue = in.getValue();
if ((inValue & signMask) == 0)
out.setValue(inValue);
else
out.setValue(inValue | extendMask);
in.addObserver(new NodeWithoutDelay(out) {
@Override
public void hasChanged() {
long inValue = in.getValue();
if ((inValue & signMask) == 0)
out.setValue(inValue);
else
out.setValue(inValue | extendMask);
}
}).hasChanged();
}