I have code of the following form in Circom circuit compiler
template DecodeUint(len) {
signal input x;
signal input pos;
signal output value;
signal output nextpos;
component getV = GetV(len);
if (x <= 23) {
value <== x;
pos ==> nextpos;
}
else if(x == 24) {
value <== 255;
pos + 1 ==> nextpos;
}
}
I'm getting this error:
error[T2005]: Typing error found
┌─ "/Users/ilia/compiling/main-circom/main.circom":93:13
│
93 │ else if(x == 24) {
│ ^^^^^^^ There are constraints depending on the value of the condition and it can be unknown during the constraint generation phase
How do I rewrite the conditions in a form that can be generated into a circuit? Is there something like Quin Selector but for if conditions?