MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / SizesForBitLen

Function SizesForBitLen

pkg/util/bitarray/bitarray.go:306–314  ·  view source on GitHub ↗

SizesForBitLen computes the number of words and last bits used for the requested bit array size.

(bitLen uint)

Source from the content-addressed store, hash-verified

304// SizesForBitLen computes the number of words and last bits used for
305// the requested bit array size.
306func SizesForBitLen(bitLen uint) (uint, uint64) {
307 // This computes ceil(bitLen / numBitsPerWord).
308 numWords := (bitLen + numBitsPerWord - 1) / numBitsPerWord
309 lastBitsUsed := uint64(bitLen % numBitsPerWord)
310 if lastBitsUsed == 0 {
311 lastBitsUsed = numBitsPerWord
312 }
313 return numWords, lastBitsUsed
314}
315
316// Parse parses a bit array from the specified string.
317func Parse(s string) (res BitArray, err error) {

Callers 3

ToWidthMethod · 0.85
EncodingPartsForBitLenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…