示例#1
0
文件: mem.go 项目: cierniak/gowasm
//wasm:invoke (invoke "PtrToInt32")
func PtrToInt32() {
	p := &Point{}
	p.x = int32(17)
	xp := &p.x
	i32 := *xp
	wasm.Print_int32(i32)
}
示例#2
0
文件: mem.go 项目: cierniak/gowasm
//wasm:invoke (invoke "PtrConvert")
func PtrConvert() {
	p := &Point{}
	u1 := unsafe.Pointer(p)
	u := uintptr(u1)
	i32 := int32(u)
	wasm.Print_int32(i32)
}
示例#3
0
文件: mem.go 项目: cierniak/gowasm
//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
文件: fac.go 项目: cierniak/gowasm
//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
文件: mem.go 项目: cierniak/gowasm
//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))
	}
}