Calculates the modulo 16 of the u4 at the top of the stack also with the quotient, parameters being internal values
(current: u32, limit: u32)
| 99 | |
| 100 | /// Calculates the modulo 16 of the u4 at the top of the stack also with the quotient, parameters being internal values |
| 101 | pub fn u4_add_carry_nested(current: u32, limit: u32) -> Script { |
| 102 | script! { |
| 103 | OP_DUP |
| 104 | OP_16 |
| 105 | OP_GREATERTHANOREQUAL |
| 106 | OP_IF |
| 107 | OP_16 |
| 108 | OP_SUB |
| 109 | if current + 1 == limit { |
| 110 | { current } |
| 111 | } else { |
| 112 | { u4_add_carry_nested(current+1, limit)} |
| 113 | } |
| 114 | OP_ELSE |
| 115 | { current } |
| 116 | OP_ENDIF |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | /// Calculates the modulo 16 of the u4 at the top of the stack, parameters being internal values |
| 121 | pub fn u4_add_nested(current: u32, limit: u32) -> Script { |
no outgoing calls
no test coverage detected