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

Function SizesForBitLen

pkg/util/bitarray/bitarray.go:312–320  ·  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

310// SizesForBitLen computes the number of words and last bits used for
311// the requested bit array size.
312func SizesForBitLen(bitLen uint) (uint, uint64) {
313 // This computes ceil(bitLen / numBitsPerWord).
314 numWords := (bitLen + numBitsPerWord - 1) / numBitsPerWord
315 lastBitsUsed := uint64(bitLen % numBitsPerWord)
316 if lastBitsUsed == 0 {
317 lastBitsUsed = numBitsPerWord
318 }
319 return numWords, lastBitsUsed
320}
321
322// Parse parses a bit array from the specified string.
323func 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…