SetBit sets the bit dictated by the bitset type.
(bs BitSetType, typ Type)
| 45 | |
| 46 | // SetBit sets the bit dictated by the bitset type. |
| 47 | func (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. |
| 70 | func (b *BitSets) SetCategoryBit(c Category) { |