MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / SetBit

Method SetBit

pkg/event/bitset.go:47–67  ·  view source on GitHub ↗

SetBit sets the bit dictated by the bitset type.

(bs BitSetType, typ Type)

Source from the content-addressed store, hash-verified

45
46// SetBit sets the bit dictated by the bitset type.
47func (b *BitSets) SetBit(bs BitSetType, typ Type) {
48 switch bs {
49 case BitmaskBitSet:
50 if b.bitmask == nil {
51 b.bitmask = bitmask.New()
52 }
53 b.bitmask.Set(typ.ID())
54
55 case TypeBitSet:
56 if b.types == nil {
57 b.types = bitset.New(uint(MaxTypeID() + 1))
58 }
59 b.types.Set(uint(typ.HookID()))
60
61 case CategoryBitSet:
62 if b.cats == nil {
63 b.cats = bitset.New(MaxCategoryIndex + 1)
64 }
65 b.cats.Set(uint(typ.Category().Index()))
66 }
67}
68
69// SetCategoryBit toggles the category bit in the bitset.
70func (b *BitSets) SetCategoryBit(c Category) {

Callers 2

TestBitSetsFunction · 0.95
walkMethod · 0.80

Calls 7

NewFunction · 0.92
MaxTypeIDFunction · 0.85
IndexMethod · 0.80
CategoryMethod · 0.80
SetMethod · 0.65
IDMethod · 0.45
HookIDMethod · 0.45

Tested by 1

TestBitSetsFunction · 0.76