Оптимизация

This commit is contained in:
Anatoly Prohacky 2022-08-12 21:46:34 +10:00
parent 20c8a73421
commit de2401a2d0

View File

@ -12,7 +12,7 @@ type AclBit int64
func New(n ...NumBit) AclBit {
var i64 AclBit
for _, n0 := range n {
i64 = SetBitTrue(i64, n0)
i64 = SetTrue(i64, n0)
}
return i64
}
@ -27,7 +27,7 @@ func veryNumBit(n NumBit) bool {
}
// unite slice int to int64
func UniteAcl(a []AclBit) AclBit {
func Unite(a []AclBit) AclBit {
var endacl AclBit
for _, a0 := range a {
endacl = endacl | a0
@ -37,7 +37,7 @@ func UniteAcl(a []AclBit) AclBit {
}
// set acl bit in true
func SetBitTrue(a AclBit, n NumBit) AclBit {
func SetTrue(a AclBit, n NumBit) AclBit {
if veryNumBit(n) {
return a | (1 << n)
}
@ -46,7 +46,7 @@ func SetBitTrue(a AclBit, n NumBit) AclBit {
}
// set acl bit in false
func SetBitFalse(a AclBit, n NumBit) AclBit {
func SetFalse(a AclBit, n NumBit) AclBit {
if veryNumBit(n) {
return a &^ (1 << n)
}
@ -55,7 +55,7 @@ func SetBitFalse(a AclBit, n NumBit) AclBit {
}
// verify bit return true or false
func VerifyBit(a AclBit, n NumBit) bool {
func Verify(a AclBit, n NumBit) bool {
if veryNumBit(n) {
var msk AclBit = 1 << n
if (a & msk) == msk {