Open
Description
In the shift operation, bit length is compared to partition, but this is not reasonable.
For example, let p = 17, a = 5 and b = 6. Then run the following code, which will shift the 5 six bits to the left, but we're still looking for a rightward shift.
Therefore, we should use p/2 as our criterion, as described in the circom documentation.
Existing implementation:
shr(a, b) {
if (b.lt(this.bitLength)) {
return a.shiftRight(b);
} else {
const nb = this.p.minus(b);
if (nb.lt(this.bitLength)) {
return this.shl(a, nb);
} else {
return bigInt.zero;
}
}
}
Metadata
Metadata
Assignees
Labels
No labels