]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/compile/internal/test/testdata/pgo/devirtualize/mult.pkg/mult.go
8a026a52f5ea1d6b62c927e1485403b7c70b6727
[gostls13.git] / src / cmd / compile / internal / test / testdata / pgo / devirtualize / mult.pkg / mult.go
1 // Copyright 2023 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // WARNING: Please avoid updating this file.
6 // See the warning in ../devirt.go for more details.
7
8 package mult
9
10 var sink int
11
12 type Multiplier interface {
13         Multiply(a, b int) int
14 }
15
16 type Mult struct{}
17
18 func (Mult) Multiply(a, b int) int {
19         for i := 0; i < 1000; i++ {
20                 sink++
21         }
22         return a * b
23 }
24
25 type NegMult struct{}
26
27 func (NegMult) Multiply(a, b int) int {
28         for i := 0; i < 1000; i++ {
29                 sink++
30         }
31         return -1 * a * b
32 }