MCPcopy
hub / github.com/cornelk/hashmap / roundUpPower2

Function roundUpPower2

util.go:13–23  ·  view source on GitHub ↗

roundUpPower2 rounds a number to the next power of 2.

(i uintptr)

Source from the content-addressed store, hash-verified

11
12// roundUpPower2 rounds a number to the next power of 2.
13func roundUpPower2(i uintptr) uintptr {
14 i--
15 i |= i >> 1
16 i |= i >> 2
17 i |= i >> 4
18 i |= i >> 8
19 i |= i >> 16
20 i |= i >> 32
21 i++
22 return i
23}
24
25// log2 computes the binary logarithm of x, rounded up to the next integer.
26func log2(i uintptr) uintptr {

Callers 1

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