blob: 43b243b4b133e0a6754a976a6d877382071514d0 [file] [log] [blame]
// 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)
}