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)
| 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 |
| 37 | func 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 |
no outgoing calls
no test coverage detected