Documentation ¶
Index ¶
- Variables
- func AlignPowTwo(x uint) uint
- func AlignPowTwo32(x uint32) uint32
- func AlignPowTwo64(x uint64) uint64
- func IsPowTwo(x uint) bool
- func IsPowTwo32(x uint32) bool
- func IsPowTwo64(x uint64) bool
- func NextPowTwo(x uint) uint
- func NextPowTwo32(x uint32) uint32
- func NextPowTwo64(x uint64) uint64
- func Pow[T constraints.Integer](x, n T) T
Constants ¶
This section is empty.
Variables ¶
var ErrOverflow = errors.New("integer overflow")
Functions ¶
func AlignPowTwo ¶
AlignPowTwo returns the next 2^n >= x, for some integer n.
If x > 2^(bits.UintSize - 1), this function panics with ErrOverflow.
func AlignPowTwo32 ¶
AlignPowTwo32 returns the next 2^n >= x, for some integer n.
If x > 2^31, this function panics with ErrOverflow.
func AlignPowTwo64 ¶
AlignPowTwo64 returns the next 2^n >= x, for some integer n.
If x > 2^63, this function panics with ErrOverflow.
func IsPowTwo32 ¶
IsPowTwo32 returns true iff x == 2^n for some integer n >= 0.
func IsPowTwo64 ¶
IsPowTwo64 returns true iff x == 2^n for some integer n >= 0.
func NextPowTwo ¶
NextPowTwo returns the next 2^n > x, for some integer n.
If x >= 2^(bits.UintSize - 1), this function panics with ErrOverflow.
func NextPowTwo32 ¶
NextPowTwo32 returns the next 2^n > x, for some integer n.
If x >= 2^31, this function panics with ErrOverflow.
func NextPowTwo64 ¶
NextPowTwo64 returns the next 2^n > x, for some integer n.
If x >= 2^63, this function panics with ErrOverflow.
func Pow ¶
func Pow[T constraints.Integer](x, n T) T
Pow implements x^n for integers.
Note that this function is not robust in the event of integer overflow.
Types ¶
This section is empty.