Skip to content

Commit

Permalink
perf: better type
Browse files Browse the repository at this point in the history
  • Loading branch information
letypequividelespoubelles committed Dec 13, 2023
1 parent 10b871e commit c26b109
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public void traceBinOperation(int stamp, Trace trace) {
.oneLineInstruction(this.maxCt() == 1)
.mli(this.maxCt() != 1)
.counter(UnsignedByte.of(ct))
.inst(Bytes.of(this.opCode().byteValue()))
.inst(UnsignedByte.of(this.opCode().byteValue()))
.argument1Hi(this.arg1().getHigh())
.argument1Lo(this.arg1().getLow())
.argument2Hi(this.arg2().getHigh())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static List<ColumnHeader> headers(int length) {
new ColumnHeader("bin.BYTE_5", 1, length),
new ColumnHeader("bin.BYTE_6", 1, length),
new ColumnHeader("bin.COUNTER", 1, length),
new ColumnHeader("bin.INST", 32, length),
new ColumnHeader("bin.INST", 1, length),
new ColumnHeader("bin.IS_AND", 1, length),
new ColumnHeader("bin.IS_BYTE", 1, length),
new ColumnHeader("bin.IS_NOT", 1, length),
Expand Down Expand Up @@ -444,18 +444,14 @@ public Trace counter(final UnsignedByte b) {
return this;
}

public Trace inst(final Bytes b) {
public Trace inst(final UnsignedByte b) {
if (filled.get(20)) {
throw new IllegalStateException("bin.INST already set");
} else {
filled.set(20);
}

final byte[] bs = b.toArrayUnsafe();
for (int i = bs.length; i < 32; i++) {
inst.put((byte) 0);
}
inst.put(b.toArrayUnsafe());
inst.put(b.toByte());

return this;
}
Expand Down Expand Up @@ -917,7 +913,7 @@ public Trace fillAndValidateRow() {
}

if (!filled.get(20)) {
inst.position(inst.position() + 32);
inst.position(inst.position() + 1);
}

if (!filled.get(21)) {
Expand Down

0 comments on commit c26b109

Please sign in to comment.