mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-18 09:24:42 -04:00
Fixes a bug that prevented the analysis of the BitExtender.
This commit is contained in:
parent
0c1714c38c
commit
249df37bd9
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user