github.com/15mga/kiwi@v0.0.2-0.20240324021231-b95d5c3ac751/util/mask.go (about) 1 package util 2 3 func GenMask(items ...int64) int64 { 4 v := int64(0) 5 for _, val := range items { 6 v |= val 7 } 8 return v 9 } 10 11 func TestMask(item, mask int64) bool { 12 return (item & mask) > 0 13 } 14 15 func MaskAddItem(item, mask int64) int64 { 16 return item | mask 17 } 18 19 func MaskDelItem(item, mask int64) int64 { 20 return ^item & mask 21 }