arnaucube
arnaucube/ark-r1cs-stdPublic Self-hosted repository
Loosen restrictions
Pratyush Mishra pratyushmishra@berkeley.edu
Fri, 08 Jan 2021 21:02:30 -0800
commit

262fac3e839eea82cd146b90432c833aa8fe1e35

parent

a44643ed76e8bfeebc8a4ae05d021b7d5aeecf56

1 files changed, 2 insertions(+), 2 deletions(-)

jump to
M src/fields/mod.rs → src/fields/mod.rs

@@ -160,8 +160,8 @@ /// `self * denominator.inverse()`.

/// 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()?;