MCPcopy Create free account
hub / github.com/BitVM/BitVM / u4_push_from_depth_half_lookup

Function u4_push_from_depth_half_lookup

bitvm/src/u4/u4_logic_stack.rs:61–70  ·  view source on GitHub ↗

Pushes the table to calculate the order of ordered pairs (a, b) satisfying the conditions a <= b and 0 <= a, b < 16

(stack: &mut StackTracker, delta: i32)

Source from the content-addressed store, hash-verified

59
60/// Pushes the table to calculate the order of ordered pairs (a, b) satisfying the conditions a <= b and 0 <= a, b < 16
61pub fn u4_push_from_depth_half_lookup(stack: &mut StackTracker, delta: i32) -> StackVariable {
62 for i in (1..17).rev() {
63 let diff = ((16 - i) * (16 - i + 1)) / 2;
64 let value = -diff + delta;
65 stack.numberi(value);
66 }
67 let lookup = stack.join_count(&mut stack.get_var_from_stack(15), 15);
68 stack.rename(lookup, "lookup");
69 lookup
70}
71
72/// Pushes the table to calculate the order of ordered pairs (a, b) satisfying the conditions a <= b and 0 <= a, b < 15
73pub fn u4_push_half_lookup_table_0_based_stack(stack: &mut StackTracker) -> StackVariable {

Callers 1

newMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected