File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -408,6 +408,31 @@ func (builder *builder[E]) Or(_a, _b frontend.Variable) frontend.Variable {
408408 builder .AssertIsBoolean (a )
409409 builder .AssertIsBoolean (b )
410410
411+ _aC , aConstant := builder .constantValue (a )
412+ _bC , bConstant := builder .constantValue (b )
413+
414+ if aConstant && bConstant {
415+ if builder .cs .IsOne (_aC ) || builder .cs .IsOne (_bC ) {
416+ return builder .cstOne ()
417+ }
418+ return builder .cstZero ()
419+ }
420+
421+ // if one input is constant, ensure we put it in b
422+ if aConstant {
423+ a , b = b , a
424+ _bC = _aC
425+ bConstant = aConstant
426+ }
427+
428+ if bConstant {
429+ if builder .cs .IsOne (_bC ) {
430+ return builder .cstOne ()
431+ } else {
432+ return a
433+ }
434+ }
435+
411436 // the formulation used is for easing up the conversion to sparse r1cs
412437 res := builder .newInternalVariable ()
413438 builder .MarkBoolean (res )
You can’t perform that action at this time.
0 commit comments