Skip to content

Commit

Permalink
fix(bin): rebase fix
Browse files Browse the repository at this point in the history
  • Loading branch information
letypequividelespoubelles committed Jan 24, 2024
1 parent 25356b3 commit 2101eb9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,9 @@
public class BinOperation extends ModuleOperation {
private static final int LIMB_SIZE = 16;

@EqualsAndHashCode.Include
private final OpCode opCode;
@EqualsAndHashCode.Include
private final BaseBytes arg1;
@EqualsAndHashCode.Include
private final BaseBytes arg2;
@EqualsAndHashCode.Include private final OpCode opCode;
@EqualsAndHashCode.Include private final BaseBytes arg1;
@EqualsAndHashCode.Include private final BaseBytes arg2;

public BinOperation(OpCode opCode, BaseBytes arg1, BaseBytes arg2) {
this.opCode = opCode;
Expand All @@ -55,9 +52,6 @@ public BinOperation(OpCode opCode, BaseBytes arg1, BaseBytes arg2) {

private static final int LLARGE = 16;
private static final int LLARGEMO = 15;
private final OpCode opCode;
private final BaseBytes arg1;
private final BaseBytes arg2;
private final int ctMax;
private List<Boolean> lastEightBits = List.of(false);
private boolean bit4 = false;
Expand All @@ -66,28 +60,6 @@ public BinOperation(OpCode opCode, BaseBytes arg1, BaseBytes arg2) {
private int pivotThreshold = 0;
private int pivot = 0;

<<<<<<<HEAD

private boolean isOneLineInstruction() {
return (opCode == OpCode.BYTE || opCode == OpCode.SIGNEXTEND) && !arg1.getHigh().isZero();
=======

@Override
public int hashCode() {
return Objects.hashCode(this.opCode, this.arg1, this.arg2);
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final BinOperation that = (BinOperation) o;
return java.util.Objects.equals(opCode, that.opCode)
&& java.util.Objects.equals(arg1, that.arg1)
&& java.util.Objects.equals(arg2, that.arg2);
>>>>>>> 49b702a1 (perf(BIN): adaptative nb line)
}

@Override
protected int computeLineCount() {
return this.ctMax + 1;
Expand All @@ -100,12 +72,12 @@ private int maxCt() {
case AND, OR, XOR -> Math.max(
0,
Math.max(
Math.max(
arg1.getHigh().trimLeadingZeros().size(),
arg2.getHigh().trimLeadingZeros().size()),
Math.max(
arg1.getLow().trimLeadingZeros().size(),
arg2.getLow().trimLeadingZeros().size()))
Math.max(
arg1.getHigh().trimLeadingZeros().size(),
arg2.getHigh().trimLeadingZeros().size()),
Math.max(
arg1.getLow().trimLeadingZeros().size(),
arg2.getLow().trimLeadingZeros().size()))
- 1);
default -> throw new IllegalStateException("Unexpected value: " + opCode);
};
Expand Down Expand Up @@ -235,7 +207,8 @@ public void traceBinOperation(int stamp, Trace trace) {
final Bytes resHi = this.getResult().getHigh().slice(offset, length);
final Bytes resLo = this.getResult().getLow().slice(offset, length);
final List<Boolean> bit1 = this.getBit1();
final List<Boolean> bits = Stream.concat(this.getFirstEightBits().stream(), this.lastEightBits.stream()).toList();
final List<Boolean> bits =
Stream.concat(this.getFirstEightBits().stream(), this.lastEightBits.stream()).toList();
for (int ct = 0; ct <= this.ctMax; ct++) {
trace
.stamp(Bytes.ofUnsignedInt(stamp))
Expand Down
2 changes: 1 addition & 1 deletion zkevm-constraints

0 comments on commit 2101eb9

Please sign in to comment.