MCPcopy Create free account
hub / github.com/tendermint/tendermint / NewBitArray

Function NewBitArray

libs/bits/bit_array.go:27–37  ·  view source on GitHub ↗

NewBitArray returns a new bit array. It returns nil if the number of bits is zero.

(bits int)

Source from the content-addressed store, hash-verified

25// NewBitArray returns a new bit array.
26// It returns nil if the number of bits is zero.
27func NewBitArray(bits int) *BitArray {
28 // Reseed non-deterministically.
29 tmrand.Reseed()
30 if bits <= 0 {
31 return nil
32 }
33 return &BitArray{
34 Bits: bits,
35 Elems: make([]uint64, numElems(bits)),
36 }
37}
38
39// Size returns the number of bits in the bitarray
40func (bA *BitArray) Size() int {

Callers 15

NewVoteSetFunction · 0.92
newBlockVotesFunction · 0.92
TestCommitFunction · 0.92
NewPartSetFromDataFunction · 0.92
NewPartSetFromHeaderFunction · 0.92
BitArrayMethod · 0.92
SetHasProposalMethod · 0.92

Calls 1

numElemsFunction · 0.85

Tested by 12

TestCommitFunction · 0.74
TestCopyFunction · 0.74
randBitArrayFunction · 0.68
TestBytesFunction · 0.68
TestEmptyFullFunction · 0.68
TestUpdateNeverPanicsFunction · 0.68
TestJSONMarshalUnmarshalFunction · 0.68
TestBitArrayToFromProtoFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…