Or computes the logical OR between two frontend.Variables.
(_a, _b frontend.Variable)
| 238 | |
| 239 | // Or computes the logical OR between two frontend.Variables. |
| 240 | func (builder *builder) Or(_a, _b frontend.Variable) frontend.Variable { |
| 241 | vars := builder.toVariableIds(_a, _b) |
| 242 | a := vars[0] |
| 243 | b := vars[1] |
| 244 | c1, ok1 := builder.constantValue(a) |
| 245 | c2, ok2 := builder.constantValue(b) |
| 246 | if ok1 && ok2 { |
| 247 | builder.AssertIsBoolean(_a) |
| 248 | builder.AssertIsBoolean(_b) |
| 249 | if c1.IsZero() && c2.IsZero() { |
| 250 | return builder.toVariable(constraint.Element{}) |
| 251 | } |
| 252 | return builder.toVariable(builder.tOne) |
| 253 | } |
| 254 | builder.instructions = append(builder.instructions, irsource.Instruction{ |
| 255 | Type: irsource.BoolBinOp, |
| 256 | X: a, |
| 257 | Y: b, |
| 258 | ExtraId: 2, |
| 259 | }) |
| 260 | return builder.addVar() |
| 261 | } |
| 262 | |
| 263 | // And computes the logical AND between two frontend.Variables. |
| 264 | func (builder *builder) And(_a, _b frontend.Variable) frontend.Variable { |
nothing calls this directly
no test coverage detected