()
| 4 | |
| 5 | impl<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)] |
no outgoing calls