MCPcopy Create free account
hub / github.com/dolthub/doltgresql / SizesForBitLen

Function SizesForBitLen

postgres/parser/utils/bitarray.go:326–334  ·  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

324// SizesForBitLen computes the number of words and last bits used for
325// the requested bit array size.
326func SizesForBitLen(bitLen uint) (uint, uint64) {
327 // This computes ceil(bitLen / numBitsPerWord).
328 numWords := (bitLen + numBitsPerWord - 1) / numBitsPerWord
329 lastBitsUsed := uint64(bitLen % numBitsPerWord)
330 if lastBitsUsed == 0 {
331 lastBitsUsed = numBitsPerWord
332 }
333 return numWords, lastBitsUsed
334}
335
336// Parse parses a bit array from the specified string.
337func Parse(s string) (res BitArray, err error) {

Callers 2

ToWidthMethod · 0.85
EncodingPartsForBitLenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected