byte.go 318 B

123456789101112131415161718192021
  1. package bitmask
  2. // Byte is a bitmask in byte.
  3. type Byte byte
  4. // Has returns true if this bitmask contains another bitmask.
  5. func (b Byte) Has(bb Byte) bool {
  6. return (b & bb) != 0
  7. }
  8. func (b *Byte) Set(bb Byte) {
  9. *b |= bb
  10. }
  11. func (b *Byte) Clear(bb Byte) {
  12. *b &= ^bb
  13. }
  14. func (b *Byte) Toggle(bb Byte) {
  15. *b ^= bb
  16. }