Source file
test/abi/leaf2.go
1
2
3
4
5
6
7
8
9
10
11
12 package main
13
14 import "fmt"
15
16 type i4 struct {
17 a, b, c, d int
18 }
19
20
21
22 func F(x i4) i4 {
23 ab := x.a + x.b
24 bc := x.b + x.c
25 cd := x.c + x.d
26 ad := x.a + x.d
27 ba := x.a - x.b
28 cb := x.b - x.c
29 dc := x.c - x.d
30 da := x.a - x.d
31
32 return i4{ab*bc + da, cd*ad + cb, ba*cb + ad, dc*da + bc}
33 }
34
35 func main() {
36 x := i4{1, 2, 3, 4}
37 y := x
38 z := F(x)
39 if (i4{12, 34, 6, 8}) != z {
40 fmt.Printf("y=%v, z=%v\n", y, z)
41 }
42 }
43
View as plain text