mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-29 20:51:45 +00:00
Add BitArray.Update()
This commit is contained in:
13
bit_array.go
13
bit_array.go
@ -302,3 +302,16 @@ func (bA *BitArray) Bytes() []byte {
|
|||||||
}
|
}
|
||||||
return bytes
|
return bytes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: other bitarray o is not locked when reading,
|
||||||
|
// so if necessary, caller must copy or lock o prior to calling Update.
|
||||||
|
// If bA is nil, does nothing.
|
||||||
|
func (bA *BitArray) Update(o *BitArray) {
|
||||||
|
if bA == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
bA.mtx.Lock()
|
||||||
|
defer bA.mtx.Unlock()
|
||||||
|
|
||||||
|
copy(bA.Elems, o.Elems)
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user