BitArray.IsEmpty()

This commit is contained in:
Ethan Buchman
2016-03-18 02:00:15 -04:00
parent 461c3b9785
commit dcfa46af13
2 changed files with 30 additions and 0 deletions

View File

@ -167,6 +167,20 @@ func (bA *BitArray) Sub(o *BitArray) *BitArray {
}
}
func (bA *BitArray) IsEmpty() bool {
if bA == nil {
return true // should this be opposite?
}
bA.mtx.Lock()
defer bA.mtx.Unlock()
for _, e := range bA.Elems {
if e > 0 {
return false
}
}
return true
}
func (bA *BitArray) IsFull() bool {
if bA == nil {
return true