Skip to content

Commit

Permalink
Enforce that a field value is on the rhs of a multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanmon committed Jan 3, 2024
1 parent a1733e2 commit f336884
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bberg/src/relation_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,11 @@ fn craft_expression<T: FieldElement>(
Expression::Number(_) => (degree, format!("(-{} + {})", rhs, lhs)),
_ => (degree, format!("({} - {})", lhs, rhs)),
},

AlgebraicBinaryOperator::Mul => (ld + rd, format!("({} * {})", lhs, rhs)),
AlgebraicBinaryOperator::Mul => match lhe.as_ref() {
// BBerg hack, we do not want a field on the lhs of an expression
Expression::Number(_) => (ld + rd, format!("({} * {})", rhs, lhs)),
_ => (ld + rd, format!("({} * {})", lhs, rhs)),
},
_ => unimplemented!("{:?}", expr),
}
}
Expand Down

0 comments on commit f336884

Please sign in to comment.