type BitMask … type bitMask … // NewEmptyBitMask creates a new, empty BitMask func NewEmptyBitMask() BitMask { … } // NewBitMask creates a new BitMask func NewBitMask(bits ...int) (BitMask, error) { … } // Add adds the bits with topology affinity to the BitMask func (s *bitMask) Add(bits ...int) error { … } // Remove removes specified bits from BitMask func (s *bitMask) Remove(bits ...int) error { … } // And performs and operation on all bits in masks func (s *bitMask) And(masks ...BitMask) { … } // Or performs or operation on all bits in masks func (s *bitMask) Or(masks ...BitMask) { … } // Clear resets all bits in mask to zero func (s *bitMask) Clear() { … } // Fill sets all bits in mask to one func (s *bitMask) Fill() { … } // IsEmpty checks mask to see if all bits are zero func (s *bitMask) IsEmpty() bool { … } // IsSet checks bit in mask to see if bit is set to one func (s *bitMask) IsSet(bit int) bool { … } // AnySet checks bit in mask to see if any provided bit is set to one func (s *bitMask) AnySet(bits []int) bool { … } // IsEqual checks if masks are equal func (s *bitMask) IsEqual(mask BitMask) bool { … } // IsNarrowerThan checks if one mask is narrower than another. // // A mask is said to be "narrower" than another if it has lets bits set. If the // same number of bits are set in both masks, then the mask with more // lower-numbered bits set wins out. func (s *bitMask) IsNarrowerThan(mask BitMask) bool { … } // IsLessThan checks which bitmask has more lower-numbered bits set. func (s *bitMask) IsLessThan(mask BitMask) bool { … } // IsGreaterThan checks which bitmask has more higher-numbered bits set. func (s *bitMask) IsGreaterThan(mask BitMask) bool { … } // String converts mask to string func (s *bitMask) String() string { … } // Count counts number of bits in mask set to one func (s *bitMask) Count() int { … } // Getbits returns each bit number with bits set to one func (s *bitMask) GetBits() []int { … } // And is a package level implementation of 'and' between first and masks func And(first BitMask, masks ...BitMask) BitMask { … } // Or is a package level implementation of 'or' between first and masks func Or(first BitMask, masks ...BitMask) BitMask { … } // IterateBitMasks iterates all possible masks from a list of bits, // issuing a callback on each mask. func IterateBitMasks(bits []int, callback func(BitMask)) { … }