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

Function u4_push_modulo_for_blake

bitvm/src/u4/u4_add_stack.rs:17–30  ·  view source on GitHub ↗

Pushes the table for calculating the modulo, i.e. 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

15
16/// Pushes the table for calculating the modulo, i.e. x % 16 for x < 48. i.e. 15 (max u4) * 3 (max # numbers to sum) + 2 (max carry)
17pub fn u4_push_modulo_for_blake(stack: &mut StackTracker) -> StackVariable {
18 stack.custom(
19 script! {
20 for i in (0..48).rev() {
21 { i % 16 }
22 }
23 },
24 0,
25 false,
26 0,
27 "",
28 );
29 stack.define(48, "modulo")
30}
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 {

Callers 3

test_add_for_blakeFunction · 0.85
newMethod · 0.85

Calls

no outgoing calls

Tested by 2

test_add_for_blakeFunction · 0.68