MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / IsPowerOfTwo

Function IsPowerOfTwo

pkg/utils/math.go:37–39  ·  view source on GitHub ↗

IsPowerOfTwo calculates if a number is power of two or not reference: https://github.com/golang/go/blob/master/src/strconv/itoa.go#L204 #wokeignore:rule=master This function will return false if the number is zero

(n int)

Source from the content-addressed store, hash-verified

35// reference: https://github.com/golang/go/blob/master/src/strconv/itoa.go#L204 #wokeignore:rule=master
36// This function will return false if the number is zero
37func IsPowerOfTwo(n int) bool {
38 return (n != 0) && (n&(n-1) == 0)
39}
40
41// ToBytes converts an input value in MB to bytes
42// Input: value - a number representing size in MB

Callers 2

buildInitDBFlagsFunction · 0.92
validateInitDBMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected