(b: u32)
| 219 | } |
| 220 | |
| 221 | pub fn add_ref_with_top(b: u32) -> Script { |
| 222 | let b_depth = b * Self::N_LIMBS; |
| 223 | assert_ne!(b, 0); |
| 224 | script! { |
| 225 | { b_depth } OP_PICK |
| 226 | OP_OVER |
| 227 | OP_ADD |
| 228 | |
| 229 | // OP_DEPTH OP_1SUB OP_PICK |
| 230 | { 1 << LIMB_SIZE } |
| 231 | OP_SWAP |
| 232 | |
| 233 | { limb_add_create_carry() } |
| 234 | OP_TOALTSTACK |
| 235 | |
| 236 | for i in 0..Self::N_LIMBS - 2 { |
| 237 | { i + 3 } OP_PICK |
| 238 | OP_ADD |
| 239 | { b_depth + i + 3 } OP_PICK |
| 240 | OP_ADD { limb_add_create_carry() } OP_TOALTSTACK |
| 241 | } |
| 242 | |
| 243 | OP_NIP |
| 244 | { b_depth + Self::N_LIMBS } OP_PICK |
| 245 | { Self::N_LIMBS + 1 } OP_PICK |
| 246 | OP_ROT |
| 247 | { limb_add_with_carry_prevent_overflow(Self::HEAD_OFFSET) } |
| 248 | |
| 249 | for _ in 0..Self::N_LIMBS - 1 { |
| 250 | OP_FROMALTSTACK |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | /// Add BigInt on top of the stack to a BigInt at `b` depth in the stack |
| 256 | /// |
nothing calls this directly
no outgoing calls
no test coverage detected