7 lines
315 B
Plaintext
7 lines
315 B
Plaintext
|
// Two-bit window lookup table using one constraint
|
||
|
// Maps the bits `b` to a list of field elements `c`
|
||
|
def main(bool[2] b, field[4] c) -> field {
|
||
|
field alpha = c[1] - c[0] + (b[1] ? (c[3] - c[2] - c[1] + c[0]) : 0);
|
||
|
field out = (b[0] ? alpha : 0) + c[0] - (b[1] ? (0 - c[2] + c[0]) : 0);
|
||
|
return out;
|
||
|
}
|