MCPcopy Create free account
hub / github.com/BitVM/BitVM / mul

Method mul

bitvm/src/bigint/mul.rs:6–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4
5impl<const N_BITS: u32, const LIMB_SIZE: u32> BigIntImpl<N_BITS, LIMB_SIZE> {
6 pub fn mul() -> Script {
7 script! {
8 { Self::convert_to_be_bits_toaltstack() }
9
10 OP_FROMALTSTACK
11 OP_IF
12 { Self::copy(0) }
13 OP_ELSE
14 { push_to_stack(0, Self::N_LIMBS as usize)}
15 OP_ENDIF
16
17 for _ in 1..N_BITS - 1 {
18 { Self::double(1) }
19 { Self::roll(1) }
20 OP_FROMALTSTACK
21 OP_IF
22 { Self::copy(1) }
23 { Self::add(1, 0) }
24 OP_ENDIF
25 }
26
27 { Self::double(1) }
28 OP_FROMALTSTACK
29 OP_IF
30 { Self::add(1, 0) }
31 OP_ELSE
32 { Self::drop() }
33 OP_ENDIF
34 }
35 }
36}
37
38#[cfg(test)]

Callers 15

test_mulFunction · 0.80
test_hinted_mulFunction · 0.80
test_hinted_mul_lc2Function · 0.80
test_hinted_squareFunction · 0.80
test_affine_equalverifyFunction · 0.80

Calls

no outgoing calls

Tested by 15

test_mulFunction · 0.64
test_hinted_mulFunction · 0.64
test_hinted_mul_lc2Function · 0.64
test_hinted_squareFunction · 0.64
test_affine_equalverifyFunction · 0.64