Edit v0.0.4
This commit is contained in:
parent
45786d84a2
commit
a39010bcfc
@ -11,9 +11,9 @@ type AclBit int64
|
||||
// New AclBit
|
||||
func New(n ...NumBit) AclBit {
|
||||
var i64 AclBit
|
||||
for _, n0 := range n {
|
||||
i64.SetTrue(n0)
|
||||
}
|
||||
|
||||
i64.SetTrue(n...)
|
||||
|
||||
return i64
|
||||
}
|
||||
|
||||
@ -28,25 +28,31 @@ func Unite(a ...AclBit) AclBit {
|
||||
}
|
||||
|
||||
// set acl bit in true
|
||||
func (a *AclBit) SetTrue(n NumBit) {
|
||||
if veryNumBit(n) {
|
||||
*a = *a | (1 << n)
|
||||
func (a *AclBit) SetTrue(n ...NumBit) {
|
||||
for _, n0 := range n {
|
||||
if veryNumBit(n0) {
|
||||
*a = *a | (1 << n0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set acl bit in false
|
||||
func (a *AclBit) SetFalse(n NumBit) {
|
||||
if veryNumBit(n) {
|
||||
*a = *a &^ (1 << n)
|
||||
func (a *AclBit) SetFalse(n ...NumBit) {
|
||||
for _, n0 := range n {
|
||||
if veryNumBit(n0) {
|
||||
*a = *a &^ (1 << n0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// verify bit return true or false
|
||||
func (a AclBit) Verify(n NumBit) bool {
|
||||
if veryNumBit(n) {
|
||||
var msk AclBit = 1 << n
|
||||
if (a & msk) == msk {
|
||||
return true
|
||||
func (a AclBit) Verify(n ...NumBit) bool {
|
||||
for _, n0 := range n {
|
||||
if veryNumBit(n0) {
|
||||
var msk AclBit = 1 << n0
|
||||
if (a & msk) == msk {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
Loading…
Reference in New Issue
Block a user