Documentation ¶
Index ¶
- func BitCount(v uint64) uint64
- func Cbrt(n uint64) (r uint64)
- func GCD(a, b uint64) uint64
- func Log10(n uint64) uint64
- func Log2(n uint64) uint64
- func Max(x, y uint64) uint64
- func Min(x, y uint64) uint64
- func Pow(x, y uint64) (r uint64)
- func Sqrt(x uint64) (r uint64)
- func TrailingZeros(v uint64) uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cbrt ¶
Cbrt returns the integer cube root of n. That is to say, the r such that:
r * r * r <= n && n < (r + 1) * (r + 1) * (r + 1)
Adapted from code found in Hacker's Delight, fixed by Fabian Giessen https://gist.github.com/729557
func Log2 ¶
Log2 returns log base 2 of n. It's the same as index of the highest bit set in n. n == 0 returns 0
func Sqrt ¶
Sqrt returns the square root of x. Based on code found in Hacker's Delight (Addison-Wesley, 2003): http://www.hackersdelight.org/
func TrailingZeros ¶
TrailingZeros returns the number of trailing 0 bits in v. If v is 0, it returns 0.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.