mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-09 01:03:08 +00:00
inverse
This commit is contained in:
parent
97f90b2266
commit
48149f93d1
@ -29,7 +29,7 @@ pub(crate) fn combined_kernel() -> Kernel {
|
||||
include_str!("asm/curve/bn254/curve_arithmetic/curve_mul.asm"),
|
||||
include_str!("asm/curve/bn254/curve_arithmetic/miller_loop.asm"),
|
||||
include_str!("asm/curve/bn254/curve_arithmetic/tate_pairing.asm"),
|
||||
include_str!("asm/curve/bn254/field_arithmetic/moddiv.asm"),
|
||||
include_str!("asm/curve/bn254/field_arithmetic/inverse.asm"),
|
||||
include_str!("asm/curve/bn254/field_arithmetic/field_macros.asm"),
|
||||
include_str!("asm/curve/bn254/field_arithmetic/fp6_mul.asm"),
|
||||
include_str!("asm/curve/bn254/field_arithmetic/fp12_mul.asm"),
|
||||
|
||||
@ -70,7 +70,7 @@ miller_end:
|
||||
|
||||
miller_one:
|
||||
// stack: 0xnm, times, O, P, Q, out, retdest
|
||||
PUSH 0x10 DUP2 LT
|
||||
DUP1 %gt_const(0x10)
|
||||
// stack: skip?, 0xnm, times, O, P, Q, out, retdest
|
||||
%jumpi(miller_zero)
|
||||
// stack: 0xnm, times, O, P, Q, out, retdest
|
||||
|
||||
@ -20,3 +20,16 @@
|
||||
%assert_eq_const(1)
|
||||
// stack: x^-1
|
||||
%endmacro
|
||||
|
||||
// Non-deterministically provide the inverse modulo N.
|
||||
%macro inverse
|
||||
// stack: x
|
||||
PROVER_INPUT(ff::bn254_base::inverse)
|
||||
// stack: x^-1 , x
|
||||
SWAP1 DUP2
|
||||
// stack: x^-1 , x, x^-1
|
||||
MULFP254
|
||||
// stack: x^-1 * x, x^-1
|
||||
%assert_eq_const(1)
|
||||
// stack: x^-1
|
||||
%endmacro
|
||||
@ -388,7 +388,8 @@ impl<'a> Interpreter<'a> {
|
||||
// should be changed to the proper implementation prime
|
||||
|
||||
fn bn_base_order_() -> U256 {
|
||||
U256::from_str("0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47").unwrap()
|
||||
U256::from_str("0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47")
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn run_addfp254(&mut self) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user