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

Function u4_push_quotient_for_blake

bitvm/src/u4/u4_add_stack.rs:33–52  ·  view source on GitHub ↗

Pushes the table for calculating the quotient, i.e. floor(x / 16) for x < 48. i.e. 15 (max u4) * 3 (max # numbers to sum) + 2 (max carry)

(stack: &mut StackTracker)

Source from the content-addressed store, hash-verified

31
32/// Pushes the table for calculating the quotient, i.e. floor(x / 16) for x < 48. i.e. 15 (max u4) * 3 (max # numbers to sum) + 2 (max carry)
33pub fn u4_push_quotient_for_blake(stack: &mut StackTracker) -> StackVariable {
34 stack.custom(
35 script! {
36 for i in (0..=2).rev() {
37 { i }
38 OP_DUP
39 OP_2DUP
40 OP_3DUP
41 OP_3DUP
42 OP_3DUP
43 OP_3DUP
44 }
45 },
46 0,
47 false,
48 0,
49 "",
50 );
51 stack.define(48, "quotient")
52}
53
54/// Arranges (zips) the given numbers (locations given by the parameters bases) each consisting of nibble_count u4's so each group of nibbles can be proccessed disceretly
55/// Does not preserve order as it's used with commutative operations

Callers 3

test_add_for_blakeFunction · 0.85
newMethod · 0.85

Calls

no outgoing calls

Tested by 2

test_add_for_blakeFunction · 0.68