Documentation ¶
Overview ¶
Package bits includes all bit related types and operations.
Index ¶
- func AlignDown(length int, align uint) int
- func AlignUp(length int, align uint) int
- func ForEachSetBit64(x uint64, f func(i int))
- func IsAnyOn32(mask, bits uint32) bool
- func IsAnyOn64(mask, bits uint64) bool
- func IsOn32(mask, bits uint32) bool
- func IsOn64(mask, bits uint64) bool
- func IsPowerOfTwo32(v uint32) bool
- func IsPowerOfTwo64(v uint64) bool
- func Mask32(is ...int) uint32
- func Mask64(is ...int) uint64
- func MaskOf32(i int) uint32
- func MaskOf64(i int) uint64
- func MostSignificantOne64(x uint64) int
- func TrailingZeros64(x uint64) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForEachSetBit64 ¶
ForEachSetBit64 calls f once for each set bit in x, with argument i equal to the set bit's index.
func IsPowerOfTwo32 ¶
IsPowerOfTwo returns true if v is power of 2.
func IsPowerOfTwo64 ¶
IsPowerOfTwo returns true if v is power of 2.
func MostSignificantOne64 ¶
MostSignificantOne64 returns the index of the most significant 1 bit in x. If x is 0, MostSignificantOne64 returns 64.
func TrailingZeros64 ¶
TrailingZeros64 returns the number of bits before the least significant 1 bit in x; in other words, it returns the index of the least significant 1 bit in x. If x is 0, TrailingZeros64 returns 64.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.