Zip the top two u{16N} elements input: a0 ... a{N-1} b0 ... b{N-1} output: a0 b0 ... ... a{N-1} b{N-1}
(mut a: u32, mut b: u32)
| 145 | /// input: a0 ... a{N-1} b0 ... b{N-1} |
| 146 | /// output: a0 b0 ... ... a{N-1} b{N-1} |
| 147 | pub fn zip(mut a: u32, mut b: u32) -> Script { |
| 148 | a = (a + 1) * Self::N_LIMBS - 1; |
| 149 | b = (b + 1) * Self::N_LIMBS - 1; |
| 150 | |
| 151 | assert_ne!(a, b); |
| 152 | if a < b { |
| 153 | script! { |
| 154 | for i in 0..Self::N_LIMBS { |
| 155 | { a + i } |
| 156 | OP_ROLL |
| 157 | { b } |
| 158 | OP_ROLL |
| 159 | } |
| 160 | } |
| 161 | } else { |
| 162 | script! { |
| 163 | for i in 0..Self::N_LIMBS { |
| 164 | { a } |
| 165 | OP_ROLL |
| 166 | { b + i + 1 } |
| 167 | OP_ROLL |
| 168 | } |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | pub fn copy_zip(mut a: u32, mut b: u32) -> Script { |
| 174 | a = (a + 1) * Self::N_LIMBS - 1; |
no outgoing calls
no test coverage detected