git ssb

0+

wanderer🌟 / js-primea-hypervisor



Tree: 3b07461593e97b8ecb99d055a38948670485d41e

Files: 3b07461593e97b8ecb99d055a38948670485d41e / wasm / interface.wast

792 bytesRaw
1(module
2 ;; useGas
3 (import $useGas "interface" "useGas" (param i32 i32))
4 (func $useGasShim
5 (param $amount i64)
6 (call_import $useGas
7 (i32.wrap/i64
8 (i64.shr_u (get_local $amount) (i64.const 32)))
9 (i32.wrap/i64 (get_local $amount)))
10 )
11 (export "useGas" $useGasShim)
12
13 ;; getGasLeft
14 (import $getGasLeftHigh "interface" "getGasLeftHigh" (result i32))
15 (import $getGasLeftLow "interface" "getGasLeftLow" (result i32))
16 (func $getGasLeft
17 (result i64)
18 (call_import $useGas (i32.const 0) (i32.const 2))
19 (return
20 (i64.add
21 (i64.shl (i64.extend_u/i32 (call_import $getGasLeftHigh)) (i64.const 32))
22 (i64.extend_u/i32 (call_import $getGasLeftLow))))
23 )
24 (export "getGasLeft" $getGasLeft)
25)
26

Built with git-ssb-web