MCPcopy Create free account
hub / github.com/allegro/bigcache / getNeededSize

Function getNeededSize

queue/bytes_queue.go:42–58  ·  view source on GitHub ↗

getNeededSize returns the number of bytes an entry of length need in the queue

(length int)

Source from the content-addressed store, hash-verified

40
41// getNeededSize returns the number of bytes an entry of length need in the queue
42func getNeededSize(length int) int {
43 var header int
44 switch {
45 case length < 127: // 1<<7-1
46 header = 1
47 case length < 16382: // 1<<14-2
48 header = 2
49 case length < 2097149: // 1<<21 -3
50 header = 3
51 case length < 268435452: // 1<<28 -4
52 header = 4
53 default:
54 header = 5
55 }
56
57 return length + header
58}
59
60// NewBytesQueue initialize new bytes queue.
61// capacity is used in bytes array allocation

Callers 1

PushMethod · 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…