mirror of
https://github.com/arnaucube/ark-r1cs-std.git
synced 2026-01-10 16:01:28 +01:00
Loosen restrictions
This commit is contained in:
@@ -160,8 +160,8 @@ pub trait FieldVar<F: Field, ConstraintF: Field>:
|
|||||||
/// It is up to the caller to ensure that denominator is non-zero,
|
/// It is up to the caller to ensure that denominator is non-zero,
|
||||||
/// since in that case the result is unconstrained.
|
/// since in that case the result is unconstrained.
|
||||||
fn mul_by_inverse(&self, denominator: &Self) -> Result<Self, SynthesisError> {
|
fn mul_by_inverse(&self, denominator: &Self) -> Result<Self, SynthesisError> {
|
||||||
if self.is_constant() && denominator.is_constant() {
|
if denominator.is_constant() {
|
||||||
Ok(self.clone() * denominator.value()?.inverse().unwrap())
|
Ok(denominator.inverse()? * self)
|
||||||
} else {
|
} else {
|
||||||
let result = Self::new_witness(self.cs(), || {
|
let result = Self::new_witness(self.cs(), || {
|
||||||
let denominator_inv_native = denominator.value()?.inverse().get()?;
|
let denominator_inv_native = denominator.value()?.inverse().get()?;
|
||||||
|
|||||||
Reference in New Issue
Block a user