(n: u32)
| 154 | } |
| 155 | |
| 156 | pub fn NMUL(n: u32) -> Script { |
| 157 | let n_bits = u32::BITS - n.leading_zeros(); |
| 158 | let bits = (0..n_bits).map(|i| 1 & (n >> i)).collect::<Vec<_>>(); |
| 159 | script! { |
| 160 | if n_bits == 0 { OP_DROP 0 } |
| 161 | else { |
| 162 | for i in 0..bits.len()-1 { |
| 163 | if bits[i] == 1 { OP_DUP } |
| 164 | { crate::pseudo::OP_2MUL() } |
| 165 | } |
| 166 | for _ in 1..bits.iter().sum() { OP_ADD } |
| 167 | } |
| 168 | } |
| 169 | } |
nothing calls this directly
no outgoing calls
no test coverage detected