u64

package
v0.0.0-...-5dc6d85 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2016 License: BSD-3-Clause Imports: 1 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BitCount

func BitCount(v uint64) uint64

Bitcount returns the number of set bits in v

func Cbrt

func Cbrt(n uint64) (r uint64)

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 GCD

func GCD(a, b uint64) uint64

GCD returns the greatest common divisor of a and b.

func Log10

func Log10(n uint64) uint64

Log10 returns log base 10 of n. n == 0 returns 0

func Log2

func Log2(n uint64) uint64

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 Max

func Max(x, y uint64) uint64

Max(x,y) returns the larger of x or y

func Min

func Min(x, y uint64) uint64

Min(x,y) returns the smaller of x or y

func Pow

func Pow(x, y uint64) (r uint64)

Pow returns x**y, the base-x exponential of y.

func Sqrt

func Sqrt(x uint64) (r uint64)

Sqrt returns the square root of x. Based on code found in Hacker's Delight (Addison-Wesley, 2003): http://www.hackersdelight.org/

func TrailingZeros

func TrailingZeros(v uint64) uint64

TrailingZeros returns the number of trailing 0 bits in v. If v is 0, it returns 0.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL