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
| // Copyright 2015 syzkaller project authors. All rights reserved.
| // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
|
| // Package cover provides types for working with coverage information (arrays of covered PCs).
| package cover
|
| type Cover map[uint32]struct{}
|
| func (cov *Cover) Merge(raw []uint32) {
| c := *cov
| if c == nil {
| c = make(Cover)
| *cov = c
| }
| for _, pc := range raw {
| c[pc] = struct{}{}
| }
| }
|
| func (cov Cover) Serialize() []uint32 {
| res := make([]uint32, 0, len(cov))
| for pc := range cov {
| res = append(res, pc)
| }
| return res
| }
|
| func RestorePC(pc uint32, base uint32) uint64 {
| return uint64(base)<<32 + uint64(pc)
| }
|
|