Пример #1
0
//wasm:invoke (invoke "PtrToInt32")
func PtrToInt32() {
	p := &Point{}
	p.x = int32(17)
	xp := &p.x
	i32 := *xp
	wasm.Print_int32(i32)
}
Пример #2
0
//wasm:invoke (invoke "PtrConvert")
func PtrConvert() {
	p := &Point{}
	u1 := unsafe.Pointer(p)
	u := uintptr(u1)
	i32 := int32(u)
	wasm.Print_int32(i32)
}
Пример #3
0
//wasm:invoke (invoke "TestPeek32")
func TestPeek32() {
	p := &Point{}
	p.x = int32(17)
	xp := &p.x
	u1 := unsafe.Pointer(xp)
	u := uintptr(u1)
	i32 := Peek32(u)
	wasm.Print_int32(i32)
}
Пример #4
0
//wasm:invoke (invoke "SimpleLoopTest" (i32.const 55) (i32.const 100))
func SimpleLoopTest(start, end int32) {
	for i := start; i < end; i = i + 20 {
		wasm.Print_int32(i)
	}
}
Пример #5
0
//wasm:invoke (invoke "DumpMemory" (i32.const 0) (i32.const 100))
func DumpMemory(start, end uintptr) {
	for i := start; i < end; i = i + 4 {
		wasm.Print_int32(Peek32(i))
	}
}