1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-05-24 05:09:09 -04:00
This commit is contained in:
Darien Raymond
2017-10-21 20:40:31 +02:00
parent 948534f480
commit 8c6f73f30b
3 changed files with 26 additions and 17 deletions

21
common/bitmask/byte.go Normal file
View File

@@ -0,0 +1,21 @@
package bitmask
// Byte is a bitmask in byte.
type Byte byte
// Has returns true if this bitmask contains another bitmask.
func (b Byte) Has(bb Byte) bool {
return (b & bb) != 0
}
func (b *Byte) Add(bb Byte) {
*b |= bb
}
func (b *Byte) Clear(bb Byte) {
*b &= ^bb
}
func (b *Byte) Toggle(bb Byte) {
*b ^= bb
}