MCPcopy
hub / github.com/jackc/pgx / getPoolIdx

Function getPoolIdx

internal/iobufpool/iobufpool.go:42–51  ·  view source on GitHub ↗
(size int)

Source from the content-addressed store, hash-verified

40}
41
42func getPoolIdx(size int) int {
43 if size < 2 {
44 return 0
45 }
46 idx := bits.Len(uint(size-1)) - minPoolExpOf2
47 if idx < 0 {
48 return 0
49 }
50 return idx
51}
52
53// Put returns buf to the pool.
54func Put(buf *[]byte) {

Callers 2

GetFunction · 0.85
TestPoolIdxFunction · 0.85

Calls 1

LenMethod · 0.65

Tested by 1

TestPoolIdxFunction · 0.68