Bitmask
type Bit uint8
func (u Bit) Or(v Bit) Bit {
return u | v
}
func (u Bit) Xand(v Bit) Bit {
return u &^ v
}
func (u Bit) Xor(v Bit) Bit {
return u ^ v
}
func (u Bit) And(v Bit) Bit {
return u & v
}
func (u Bit) Is(v Bit) bool {
return u == v
}
func (u Bit) IsNot(v Bit) bool {
return u != v
}
func (u Bit) Has(v Bit) Bit {
return u.And(v).IsNot(0)
}Last updated