MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / NewBitArray

Function NewBitArray

libs/bits/bit_array.go:24–32  ·  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

22// NewBitArray returns a new bit array.
23// It returns nil if the number of bits is zero.
24func NewBitArray(bits int) *BitArray {
25 if bits <= 0 {
26 return nil
27 }
28 return &BitArray{
29 Bits: bits,
30 Elems: make([]uint64, (bits+63)/64),
31 }
32}
33
34// Size returns the number of bits in the bitarray
35func (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
ensureVoteBitArraysMethod · 0.92
SetHasProposalMethod · 0.92

Calls

no outgoing calls

Tested by 11

TestCommitFunction · 0.74
randBitArrayFunction · 0.68
TestBytesFunction · 0.68
TestEmptyFullFunction · 0.68
TestUpdateNeverPanicsFunction · 0.68
TestJSONMarshalUnmarshalFunction · 0.68
TestBitArrayProtoBufFunction · 0.68