1
0
Fork 0
mirror of synced 2025-09-24 04:40:05 +00:00
ZoKrates/zokrates_stdlib/stdlib/utils/multiplexer/lookup3bitSigned.zok
2020-06-05 17:11:07 +02:00

11 lines
No EOL
329 B
Text

import "./lookup2bit" as lookup
// /**
// * Three-bit window lookup (2bits + signature bit) in 2bit table
// * using two constraints. Maps the bits `b` to a list of constants `c`
// */
def main(bool[3] b, field[4] c) -> (field):
field alpha = lookup(b[0..2], c)
field out = alpha - if b[2] then 2*alpha else 0 fi
return out