mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-29 12:41:44 +00:00
BitArray.IsEmpty()
This commit is contained in:
14
bit_array.go
14
bit_array.go
@ -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
|
||||
|
Reference in New Issue
Block a user