-
Notifications
You must be signed in to change notification settings - Fork 943
/
Copy pathgc.go
75 lines (65 loc) · 1014 Bytes
/
gc.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
package main
var (
scalar1 *byte
scalar2 *int32
scalar3 *int64
scalar4 *float32
array1 *[3]byte
array2 *[71]byte
array3 *[3]*byte
struct1 *struct{}
struct2 *struct {
x int
y int
}
struct3 *struct {
x *byte
y [60]uintptr
z *byte
}
struct4 *struct {
x *byte
y [61]uintptr
}
slice1 []byte
slice2 []*int
slice3 [][]byte
)
func newScalar() {
scalar1 = new(byte)
scalar2 = new(int32)
scalar3 = new(int64)
scalar4 = new(float32)
}
func newArray() {
array1 = new([3]byte)
array2 = new([71]byte)
array3 = new([3]*byte)
}
func newStruct() {
struct1 = new(struct{})
struct2 = new(struct {
x int
y int
})
struct3 = new(struct {
x *byte
y [60]uintptr
z *byte
})
struct4 = new(struct {
x *byte
y [61]uintptr
})
}
func newFuncValue() *func() {
return new(func())
}
func makeSlice() {
slice1 = make([]byte, 5)
slice2 = make([]*int, 5)
slice3 = make([][]byte, 5)
}
func makeInterface(v complex128) interface{} {
return v // always stored in an allocation
}