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

Function u32_push

bitvm/src/u32/u32_std.rs:5–22  ·  view source on GitHub ↗

Pushes a value as u32 element onto the stack, least significant part being on top

(value: u32)

Source from the content-addressed store, hash-verified

3
4/// Pushes a value as u32 element onto the stack, least significant part being on top
5pub fn u32_push(value: u32) -> Script {
6 script! {
7 //optimization
8 if ((value >> 24) & 0xff) == ((value >> 16) & 0xff) &&
9 ((value >> 24) & 0xff) == ((value >> 8) & 0xff) &&
10 ((value >> 24) & 0xff) == (value & 0xff) {
11
12 { push_to_stack(((value >> 24) & 0xff) as usize, 4) }
13 }
14 else{
15
16 {(value >> 24) & 0xff}
17 {(value >> 16) & 0xff}
18 {(value >> 8) & 0xff}
19 {value & 0xff}
20 }
21 }
22}
23
24/// Marks transaction as invalid if the top two stack value are not equal
25pub fn u32_equalverify() -> Script {

Callers 2

sha256_initFunction · 0.85
sha256_kFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected