Browse Source

Loosen restrictions

master
Pratyush Mishra 4 years ago
parent
commit
262fac3e83
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/fields/mod.rs

+ 2
- 2
src/fields/mod.rs

@ -160,8 +160,8 @@ pub trait FieldVar:
/// It is up to the caller to ensure that denominator is non-zero,
/// since in that case the result is unconstrained.
fn mul_by_inverse(&self, denominator: &Self) -> Result<Self, SynthesisError> {
if self.is_constant() && denominator.is_constant() {
Ok(self.clone() * denominator.value()?.inverse().unwrap())
if denominator.is_constant() {
Ok(denominator.inverse()? * self)
} else {
let result = Self::new_witness(self.cs(), || {
let denominator_inv_native = denominator.value()?.inverse().get()?;

Loading…
Cancel
Save