forked from go-interpreter/wagon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conv.go
93 lines (70 loc) · 1.86 KB
/
conv.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Copyright 2017 The go-interpreter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package exec
import (
"math"
)
func (vm *VM) i32Wrapi64() {
vm.pushUint32(uint32(vm.popUint64()))
}
func (vm *VM) i32TruncSF32() {
vm.pushInt32(int32(math.Trunc(float64(vm.popFloat32()))))
}
func (vm *VM) i32TruncUF32() {
vm.pushUint32(uint32(math.Trunc(float64(vm.popFloat32()))))
}
func (vm *VM) i32TruncSF64() {
vm.pushInt32(int32(math.Trunc(vm.popFloat64())))
}
func (vm *VM) i32TruncUF64() {
vm.pushUint32(uint32(math.Trunc(vm.popFloat64())))
}
func (vm *VM) i64ExtendSI32() {
vm.pushInt64(int64(vm.popInt32()))
}
func (vm *VM) i64ExtendUI32() {
vm.pushUint64(uint64(vm.popUint32()))
}
func (vm *VM) i64TruncSF32() {
vm.pushInt64(int64(math.Trunc(float64(vm.popFloat32()))))
}
func (vm *VM) i64TruncUF32() {
vm.pushUint64(uint64(math.Trunc(float64(vm.popFloat32()))))
}
func (vm *VM) i64TruncSF64() {
vm.pushInt64(int64(math.Trunc(vm.popFloat64())))
}
func (vm *VM) i64TruncUF64() {
vm.pushUint64(uint64(math.Trunc(vm.popFloat64())))
}
func (vm *VM) f32ConvertSI32() {
vm.pushFloat32(float32(vm.popInt32()))
}
func (vm *VM) f32ConvertUI32() {
vm.pushFloat32(float32(vm.popUint32()))
}
func (vm *VM) f32ConvertSI64() {
vm.pushFloat32(float32(vm.popInt64()))
}
func (vm *VM) f32ConvertUI64() {
vm.pushFloat32(float32(vm.popUint64()))
}
func (vm *VM) f32DemoteF64() {
vm.pushFloat32(float32(vm.popFloat64()))
}
func (vm *VM) f64ConvertSI32() {
vm.pushFloat64(float64(vm.popInt32()))
}
func (vm *VM) f64ConvertUI32() {
vm.pushFloat64(float64(vm.popUint32()))
}
func (vm *VM) f64ConvertSI64() {
vm.pushFloat64(float64(vm.popInt64()))
}
func (vm *VM) f64ConvertUI64() {
vm.pushFloat64(float64(vm.popUint64()))
}
func (vm *VM) f64PromoteF32() {
vm.pushFloat64(float64(vm.popFloat32()))
}