arnaucube
arnaucube/ark-r1cs-stdPublic Self-hosted repository
Reduce density of `ThreeBitCondNegLookup`

jon-chuang 9093549+jon-chuang@users.noreply.github.com
Wed, 25 Nov 2020 16:26:32 +0800
commit

905e7284b2511f59cb5ea1890cd5e0c3d200db41

parent

68f08b94d23dd6cb87a332f020c3df7625caf498

1 files changed, 4 insertions(+), 3 deletions(-)

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

@@ -594,10 +594,11 @@ let y_lc = b0b1.lc() * (c[3] - &c[2] - &c[1] + &c[0])

+ b[0].lc() * (c[1] - &c[0]) + b[1].lc() * (c[2] - &c[0]) + (c[0], Variable::One); + // enforce y * (1 - 2 * b_2) == res b.cs().enforce_constraint( - y_lc.clone() + y_lc.clone(), - b[2].lc(), - y_lc - result.variable, + y_lc.clone(), + b[2].lc() * F::from(2u64).neg() + (F::one(), Variable::One), + lc!() + result.variable, )?; Ok(result)