ConstShape shows only as much bits as necessary.

This commit is contained in:
hneemann 2017-06-20 08:22:28 +02:00
parent c705acc033
commit 8b842d3784

View File

@ -15,6 +15,7 @@ import de.neemann.digital.draw.graphics.Vector;
/**
* The constant shape
*
* @author hneemann
*/
public class ConstShape implements Shape {
@ -31,7 +32,9 @@ public class ConstShape implements Shape {
*/
public ConstShape(ElementAttributes attr, PinDescriptions inputs, PinDescriptions outputs) {
this.outputs = outputs;
this.value = ObservableValue.getHexString(attr.get(Keys.VALUE));
int bits = attr.getBits();
long mask = (1L << bits) - 1;
this.value = ObservableValue.getHexString(attr.get(Keys.VALUE) & mask);
}
@Override